[music-dsp] Newbie question
Vladimir Ivanov
vladitx at dce.bg
Thu Nov 15 06:11:28 EST 2001
From: Jeremy Garrard <Jeremy.Garrard at torex.com>
> 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!
mixing two 16-bit values yields only 17-bit result. mixing three 16-bit values yields maximum 18-bit result.
if yon can't know the signals' dynamic range before mixing you can choose between:
1. post-normalize after mixing back to 16-bit (by division with rounding)
or
2. clip the 17-bit result to 16-bit. this leads to nonreversible distorsions when value is outside [-32768, 32767], but when used
carefully gives good performance.
of course some combination of both is possible.
cheers,
-- vladitx
dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/
More information about the music-dsp
mailing list