I am not sure if I understand meaning of “bit depth” in audio.

As I see in many audio applications 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.0f / 2147483647.0f, or maybe 2.0f / 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 logarithms and powers) 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. Best Regards

  • $\begingroup$ "bit depth" is an audiophile term for word width of the fixed-point words representing the sampled audio signal. $\endgroup$ – robert bristow-johnson Mar 7 at 20:24

Bit depth is typically applied to a fixed point representation. 16-bit means the number can go from -2^15 to 2^15-1 so from -32768 to +32767. For 8 bits that would be -128 to +127.

If you normalize to a maximum of 1, your least significant bit (LSB) value is simply the inverse, 1/32678 = 3.0518e-05 for 16 bit or 1/128 = 0.0078125 for 8 bit

Floating point works completely differently. A 32-bit floating point number has a 24 bit mantissa and an 8 bit exponent. So it's basically a 24-bit integer number combined with an 8 bit scale factor that gets "optimized" and recalculated on every floating point operation. See https://en.wikipedia.org/wiki/Floating-point_arithmetic


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.