[music-dsp] Simple signal mixing algorithm

Michael Gogins gogins at pipeline.com
Wed Jul 20 09:40:32 EDT 2005


As far as the sound itself is concerned, you should simply add the signals, no matter how many there are. Digital audio is a strictly linear system.

If you are going to clip, then you should convert all your signals to floats or doubles first. Either rescale each signal by the same factor before mixing them, or rescale the mixed signal after mixing it, to avoid clipping before converting back to 16 bits.

In general, it is much better to perform all audio calculations on floats (the standard) or doubles (sometimes useful for added precision and lower noise, e.g. for IIR coefficients).

Hope this helps,
Mike

-----Original Message-----
From: Eddie <eddie at roughproductions.co.uk>
Sent: Jul 20, 2005 9:32 AM
To: music-dsp <music-dsp at shoko.calarts.edu>
Subject: Re: [music-dsp] Simple signal mixing algorithm

Forgot to add - i am working with samples from -32767 to 32767 for 
16bit audio... do i need to convert to logarithmic/db values and do any 
calculations?

Thanks

Eddie

On 20 Jul 2005, at 14:28, Eddie Al-Shakarchi wrote:

> Hi there
>
> When adding together/mixing a few audio signals, how should the 
> signals be added in order to stop clipping?
>
> As in, if adding together 3 signals, should the values for each sample 
> be added together, and then divided by three? Is that ok?
>
> What if the signal is stereo, does this affect anything?
>
> With the particular thing i'm working on, i give the user to option of 
> normalizing the data which is being summed, otherwise, if there's 
> three inputs, then the samples are added together and then divided by 
> three. That ok?
>
> Sorry if it's very basic but i haven't really thought about it before!
>
> Thanks
>
> Eddie
>
> --
> 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 
> http://ceait.calarts.edu/mailman/listinfo/music-dsp
>

--
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 
http://ceait.calarts.edu/mailman/listinfo/music-dsp






More information about the music-dsp mailing list