[music-dsp] Newbie question
Jeremy.Garrard at torex.com
Thu Nov 15 05:10:07 EST 2001
I'm a newbie to both this list and DSP.
I'm a proffesional programmer by trade, and although I have lots of exposure
to digital sound, I know very little about the actual theory so I wonder if
someone could answer a simple question...
If I have 2x 16 bit samples (left & right), how do I mix them into one?
My first thought would be to simply add them together and then scale to 16
bits again. (ie find the highest amplitute in the wave and make this
equivilent to a "full" 16 bit sample, then scale all the rest respectively.
However, although this might work (possibly! No doubt I'm talking rubbish!)
if I have a complete sample, so I know the maximum amplitute that will ever
be reached, I cannot see how to do it in realtime with just a small "packet"
of samples, because the maximum amplitute in each packet will not
nessecarily correspond to the maximum amplitude in the entire wave.
After pondering this for a while I thought that maybe I just need to divide
all samples by 2, because in theory the maximum amplitute I can have is 32
bits (when mixing 2x 16 bit samples). However, this is obviously wrong
because if I was mixing 3 samples, then I would need to divide by 3, and
what if the third sample was silence? I would have effectively just reduced
the volume by one third. I give up!
Thanks for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the music-dsp