Audio Mixing

Im working on a program that needs audio mixing. The problem i have is scaling the sound. For example i have 24 active samples at once. If add them all together and divide them by 24 that would not produce a good result if 1 or more samples are very low. Anyone know the best way to scale the sound so that it's always at a good limit.
Would this work ?:
x = sum of samples
y = x / 65536 (i work with unsigned data)
y is now rounded upwards.
final sound is:
x = x / y

What i need is some good formula to scale sound correctly.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!