From: Jaroslaw Sobierski <fycio@gucio.com>
To: alsa-devel@lists.sourceforge.net
Subject: Re: dmix plugin
Date: Mon, 17 Feb 2003 02:04:01 -0800 [thread overview]
Message-ID: <1045476241.3e50b391808f8@webmail2.namezero.com> (raw)
> > b) sum overflow: we can lower volume of samples before sum; I think that
> > hardware works in this way, too
>
> Here I don't understand you. Suppose we have 3 samples to mix:
> a = 0x7500
> b = 0x7400
> c = 0x8300
>
> If you do a + b + c (in this order) you obtain:
> d=0
> d += a -> 7500
> d += b -> 0xe900 -> 0x7fff
> d += c -> 0x02ff
>
> while the correct result is 0x6c00. You see?
AFAIK most hardware does not mix by reducing volume before the sum. On the
contrary, it is usually summed "as is" to a wider register, and often even so
used. For example, a sound card able to mix 16 chanels of 16 bits would have
a 16+4 bits or 24 bit register were the channels are added and no saturation
can occur. In good hardware this would not even be downscaled back to 16 bits,
but a 24 bit D/A converter would be used instead. In older times (Gravis Ultra
Sound and I think older SB AWE) this could easily be spotted by the difference
in supported "hardware" channels and "software" channels. A card with a 32 bit
sum register and 24 bit DA could support (as above) 16 hardware channels and
for example 64 software channels (mixed together in quadrouplets to the 16 hw).
In our case, such "solution" would have to affect the whole buffer, meaning
we would need 3 (or better yet 4) bytes per sample, which would eventually get
reduced back to 2 bytes on the way out to the sound card. This seems neither
elegant nor memory efficient but would work, and also solves the "a)" problem
because we don't need to saturate so an atomic add can be performed on each
sample.
--------------
Fycio (J.Sobierski)
fycio@gucio.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
next reply other threads:[~2003-02-17 10:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-17 10:04 Jaroslaw Sobierski [this message]
2003-02-17 10:15 ` Re: dmix plugin Jaroslav Kysela
2003-02-17 12:15 ` Abramo Bagnara
2003-02-17 13:12 ` Jaroslav Kysela
2003-02-17 13:29 ` Abramo Bagnara
2003-02-17 15:00 ` Jaroslav Kysela
2003-02-17 15:21 ` Abramo Bagnara
2003-02-17 10:32 ` tomasz motylewski
-- strict thread matches above, loose matches on Subject: below --
2003-02-13 10:28 Marc Titinger
2003-02-12 18:04 Marc Titinger
2003-02-12 19:21 ` Jaroslav Kysela
2003-02-13 9:51 ` Takashi Iwai
2003-02-13 16:30 ` Jaroslav Kysela
[not found] <20030212125323.C75F059D34D@kerberos.suse.cz>
2003-02-12 13:32 ` Jaroslav Kysela
2003-02-12 9:45 Jaroslav Kysela
2003-02-12 12:18 ` Takashi Iwai
2003-02-12 13:55 ` Jaroslav Kysela
2003-02-12 12:57 ` Paul Davis
2003-02-13 13:10 ` Abramo Bagnara
2003-02-16 13:27 ` Jaroslav Kysela
2003-02-16 18:00 ` Abramo Bagnara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1045476241.3e50b391808f8@webmail2.namezero.com \
--to=fycio@gucio.com \
--cc=alsa-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.