Max number of audio channel


#1

Hi,

I’ve seen in the AudioSampleBuffer::readFromAudioReader method that the code only expect 2 channels.
Is there any limitation elsewhere on the audio channel count ?

I was wondering if I can do 7.1 audio output with current code.

Also, does Juce expect audio sample to be normalized between 0.0f and 1.0f ?
The method above divides the input by 0x7FFFFFFF, but as I have never used it, it don’t know if the AudioReader should be multiplying its samples so the MSB is set for the maximum value.
If I give an input in [0.0f 1.0f] range, it should play with full dynamic, right ?


#2

readFromAudioReader is really just a convenient method for playing stereo, because that’s what you need most of the time - you can use the format readers directly if you want to do clever things with multiple channels.

Floating point audio is always in the range -1.0 to 1.0, so that silence is 0.


#3

Ok. Thank you.
So for newbies like me, the sample read from in the AudioReader should be in the range [-INT_MAX ; INT_MAX] (so you’ll have to shift left your file’s signed 16 bits samples, <<16, so it is in the expected range).
If it’s unsigned you’ll have to remove half the bit range first before shifting.