Re: [linux-audio-dev] [newbie] mixing audio streams

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] [newbie] mixing audio streams
From: Steve Harris (S.W.Harris_AT_ecs.soton.ac.uk)
Date: Sun Mar 14 2004 - 13:07:09 EET


On Sun, Mar 14, 2004 at 11:54:53AM +0100, Alex Marandon wrote:
> I've made some tries with simply dividing the sum of samples by the
> number of sample (ie: buffer1[i] + buffer2[i] / 2) and the result is not
> so bad.

If the number of channles is constant anbd low (eg. 2) then this is OK,
but if it varies or is large you can have problems - you have to change
the sclaning factor when the number of channels change (you will get
clicks or have some complex crossfading problems to solve), and if its
large the output will be very quiet.

There is a rule of thumb scaing factor which is something like divide by
sqrt(number_of_channels), but that doesnt guarantee no clipping, and it
still fails if the number of channels changes. Works better for larger
numbers of channels though.

- Steve


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Sun Mar 14 2004 - 13:07:15 EET