0

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 Python, the audio is composed 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.

  • Hello. What is your question ? – audionuma Jul 3 at 18:27
  • @audionuma I think it's on the title... though the body could use some edits to make it clear what OP is asking – DarkCygnus Jul 3 at 18:43
  • 1
    Anyways, I think you are correct @user173729 the analog signal from the mic is digitalized via a ADC, although I don't see why you mentioned FFT as it seems you pulled it out of nowhere. – DarkCygnus Jul 3 at 18:45
1

Your best bet is to research "digital audio sampling theory". Some brave soul could possibly spend time loading all of the current research data into a stack answer, but it would duplicate a lot of really good reading material that is currently out there.

You are very close with your current observations, but you should take into account that an analogue audio signal is basically 'alternating current', in that the changing sound pressure that reaches the microphone capsule is made up of areas of compression and decompression of the air around the capsule. Consequently, the voltage that is generated by the capsule is both positive and negative depending on the direction of excursion of the capsule. You will likely see a "zero" voltage level being the 'centre' of the signal, and the signal varying both positively and negatively around this 'centre'.

The 'number' that is used to represent the sampled voltage will depend very much on the format of the samples. You could use 'signed integers', 'unsigned integers' or 'floating point'.

Floating point is easiest to understand as it is by nature a real number with a range of -1.0 through 1.0 and every sample will lie somewhere in this range.

The signed integer range will depend entirely on the bit resolution of the sample. For instance a signed 8-bit integer will lie on a range of -127 through +127 and an unsigned 8-bit integer will lie on a range of 0 through 255.

When passing this data through an FFT library, you will need to use similar numeric encoding, or pass the data through a transformation function in order to adapt it to a format that the FFT library will want to work with.

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.