Re: Stereo > Mono Downmixing on iOS
Re: Stereo > Mono Downmixing on iOS
- Subject: Re: Stereo > Mono Downmixing on iOS
- From: Richard Dobson <email@hidden>
- Date: Fri, 01 Apr 2011 01:20:25 +0100
On 01/04/2011 00:45, Roman Thilenius wrote:
..
1) adding samples together may overflow the sample format
2) it is almost certain never to happen if the sample format is
floating point
this is not as absolute as you say IMO.
think of an application like a sampling instrument with 2000 voices,
each channel beeing set to +3dB/A.
now sum them using float32 and see what happens. :D
This thread is becoming surreal. The outcome of the above: 1.4 (approx)
* 2000 = 2800.0. This does ~not~ overflow the IEEE 32bit float number
format. The thing about floats in audio is that 0dBFS (aka digital
peak) is by convention ~defined~ to be 1.0, so all that is needed is
that at the point of sending to the (integer) dac the floats are scaled
back as needed. In 32bit floats you have the equivalent of some 7
decimal digits of precision, so numbers such as 999999.1 and
0.00009999991 can both be accommodated. The one danger with adding is
adding a very large number to a very small number; then you cannot
expect to get an accurate result - essentially you lose the small value.
But that represents an inaudibly low level anyway compared to the big
number. But it might actually be done as a simple way to evade the
denormal problem.
So in short, even in floats, if you sum two samples at 1.0 you get 2.0;
this will need to be scaled back to the mandated +-1.0 range before
passing to the dac, or it will get clipped. That's all there is to it.
No mystery, no big deal.
BTW: summing 2000+ float values is commonplace. It happens in FFTs and
FIR filters all the time.
Richard Dobson
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden