I am not sure if I understand meaning of “bit depth” in audio.
As I see in Juce projects in
processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages) the audio sample values (when not distorted) are between
minValue = -1.0f; and
maxValue = 1.0f;.
I need to know the smallest possible value next to 0.0f of one sample.
As I suppose “x bit depth” means that one sample can be expressed by 2^16 various values. Am I right?
So does it mean that the smallest possible sample value change is
(maxValue - minValue) / (pow(2.0f, x)) ??? So for 16 bit depth is it
2.0f / pow(2.0f, 16.0f) ?? Which is 4.6566128742e-10 ?
I have mess in mind, couse I have even problem with simple
float variable. As I know it has 32 bits. So the biggest value should be 2^31 (and one bit for sign) which is 2147483647. And for
int it works, but how is it possible that float max value can be 3.40282e+38 ? Which is much more than 2147483647.
So let’s imagine I have audio with 32 bit depth. So then the smallest possible sample value change is 2/2147483647, or maybe 2/3.40282e+38 ???
And other issue is: should I realy devide
(maxValue - minValue) / (pow(2.0f, x)) - which means bit depth concern to amplitude. Or it concern to gain - which means I should calculete it by
1.0f / (pow(2.0f, x)) ?
Please help me to understand it because my math calculations (a lot of
pow()) gives me a lot of “NaN” and “inf”. So I need to narrow the possible inputs and outputs to avoid such errors. But first I need to understand how to do that.
For any help great thanks in advance.