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
