Forums

Digital Audio Mixing Algorithms?

Started by Alexander J. Oss January 13, 2004
Can anyone point me in the direction of some good technical literature on
approaches one can take in developing digital audio mixing software?  In
particular, I'd like to know the most common and/or effective methods of
avoiding clipping after addition.

Thanks very much!


In comp.dsp, "Alexander J. Oss" <alex@alexoss.net> wrote:

>Can anyone point me in the direction of some good technical literature on >approaches one can take in developing digital audio mixing software? In >particular, I'd like to know the most common and/or effective methods of >avoiding clipping after addition.
I think you mean clipping/overflow DURING addition, because afterwards is too late! The addition itself is quite simple, as long as you have a large enough bit depth, such as 32 bits for 24-bit samples, you can put the [sign-extended] 24-bit words in the least-significant 24 bits of the 32 bit words, then you can sum up to 256 channels without overflowing. If you use floating point, you should pehaps use 64-bit floats, since a 32-bit float only has a 24-bit mantissa, and and errors/noise could build up and become audinle with repeated calculations. OTOH, if your application is a phone answering machine or similar quality device, you can do everything with 16 bits, or maybe even get away with eight bits. (!) The scaling or changing volume appears simple (just multiply each sample by your 'volume' variable for that channel), but this (and converting your 32-bit sum back to 24 or 16 bits) gets complicated. There's a good discussion of the 'proper' way to do the process at this site, click on Articles, then Dither: http://digido.com
>Thanks very much! >
----- http://mindspring.com/~benbradley
"Ben Bradley" <ben_nospam_bradley@mindspring.example.com> wrote in message
news:ld8b00tmvj4ctlmbtcb9b4ii4rdkarusho@4ax.com...
> In comp.dsp, "Alexander J. Oss" <alex@alexoss.net> wrote: > > >Can anyone point me in the direction of some good technical literature on > >approaches one can take in developing digital audio mixing software? In > >particular, I'd like to know the most common and/or effective methods of > >avoiding clipping after addition.
Reduce the level before addition? <snip>
> If you use floating point, you should pehaps use 64-bit floats, > since a 32-bit float only has a 24-bit mantissa, and and errors/noise > could build up and become audinle with repeated calculations.
I would disagree with this. Unless you are doing IIR filters with extreme settings, I've never found 32-bit floating point to be insufficient for audio work. You essentially never overflow and you always have 24-bits of precision, even with low signal levels. And just for the record, the IEEE 32-bit floating point actually has a 25-bit mantissa due to the "hidden bit". (This assumes you count the sign bit as part of the mantissa, which it effectively is.)
In article <bu4dkg$d6ncs$1@ID-210375.news.uni-berlin.de>,
Jon Harris <goldentully@hotmail.com> wrote:
>"Ben Bradley" <ben_nospam_bradley@mindspring.example.com> wrote in message >news:ld8b00tmvj4ctlmbtcb9b4ii4rdkarusho@4ax.com... >> In comp.dsp, "Alexander J. Oss" <alex@alexoss.net> wrote: >> >> >Can anyone point me in the direction of some good technical literature on >> >approaches one can take in developing digital audio mixing software? In >> >particular, I'd like to know the most common and/or effective methods of >> >avoiding clipping after addition. > >Reduce the level before addition?
As long as the temporary result doesn't overflow, wouldn't it result in less rounding noise to reduce the level after the addition? You might also be able to use an AGC circuit to determine if and how much to reduce the level to avoid any clipping. IMHO. YMMV. -- Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ #include <canonical.disclaimer> // only my own opinions, etc.
"Ronald H. Nicholson Jr." <rhn@mauve.rahul.net> wrote in message
news:bu4ir7$rnj$2@blue.rahul.net...
> In article <bu4dkg$d6ncs$1@ID-210375.news.uni-berlin.de>, > Jon Harris <goldentully@hotmail.com> wrote: > >"Ben Bradley" <ben_nospam_bradley@mindspring.example.com> wrote in
message
> >news:ld8b00tmvj4ctlmbtcb9b4ii4rdkarusho@4ax.com... > >> In comp.dsp, "Alexander J. Oss" <alex@alexoss.net> wrote: > >> > >> >Can anyone point me in the direction of some good technical literature
on
> >> >approaches one can take in developing digital audio mixing software?
In
> >> >particular, I'd like to know the most common and/or effective methods
of
> >> >avoiding clipping after addition. > > > >Reduce the level before addition? > > As long as the temporary result doesn't overflow, wouldn't it result > in less rounding noise to reduce the level after the addition?
If you have extended precision in your temporary result registers, then yes this makes sense.
> You might also be able to use an AGC circuit to determine if and how > much to reduce the level to avoid any clipping.
Certainly possible, but most mixers don't do this. It could result in for example, your signal suddenly becoming quieter for some period because a clip ocurred.
> > IMHO. YMMV. > -- > Ron Nicholson rhn AT nicholson DOT com http://www.nicholson.com/rhn/ > #include <canonical.disclaimer> // only my own opinions, etc.