1
$\begingroup$

Based on some reading, here's my understanding of how sound recording works:

Microphone outputs a voltage based on sound pressure. The microphone voltage is amplified and the amplified voltage goes into an ADC. The amplifier gain is such that the maximum microphone output is matched to the maximum input voltage of the ADC. The ADC converts the input voltage into a number, and this number's magnitude can depend on the number of bits. So let's say the max input voltage is 5V, this would be 255 for 8 bit, or 65535 for 16 bit.

When I record an audio stream using something like PyAudio on Python, the audio is composed of list of numbers that the ADC outputs, and that can vary based on if I used 8 bit or 16 bit encoding. Therefore, the FFT magnitude will vary too.

Please correct me if I'm wrong.

$\endgroup$

1 Answer 1

1
$\begingroup$

With very few exceptions any audio processing these days is done in floating point, i.e. the data that comes through the ADC is immediately converted to floating point numbers and normalized so that the max voltage corresponds to a value of 1.0. This eliminates any dependency of the scaling to the number of bits.

Fixed point processing is quite difficult and typically requires specialized data types and intensive scaling and noise management.

The output of an 8-bit ADC could be interpreted as the numbers $-128,-127, ...+127$ but it's almost always better to think of it as $-1, -127/128, .. -1/128 , 0 ,+1/128 ... +127/128$

$\endgroup$
1
  • $\begingroup$ Agreed. In most cases you want to «abstract» the i/o to a i/o module, then do your processing in a general way. You probably don’t want your audio encoder or whatever branch into different sections depending on if the ADC is 8-bit or 16-bit. There may be exceptions to this, eg if you want to characterize an AD converter or if you want to do absolute SPL measurements (but then you might want to calibrate to SPL numbers anyways) $\endgroup$
    – Knut Inge
    Dec 20, 2021 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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