How to extract frequency from WAV sample data?

I am developing an application in c for reading simple WMA files for PCM. My question is: how should I interpret samples from a data block so that I can extract the sampling frequency?

Given the WAV example, how the raw data represents the frequencies. For instance. this data block, 24 17 1e f3, for stereo, 16 bit, the choice of the left channel is 0x1724 = 5924d, means 5924Hz? How can this be for fastened patterns or frequencies that people cannot hear?

+4
source share
2 answers

Your guess is wrong. The sample data is simply a digital representation of the actual sound wave. Numbers represent the amplitude of the wave, the offset of the array represents time.

I would suggest reading about how audio is presented , in particular PCM .

To convert this data (amplitude-vs-time) to frequency data, you need to understand the basic concepts of Fourier transform

I really suggest taking the time to read them before trying to do any kind of sound processing.

+9
source

You can extract the sampling frequency in the WAV header, but if you need the actual frequency data of the recorded sound, that is, how much energy is at 200 Hz, how much is 2 kHz, how much is 8 kHz, etc. you need to do an FFT or run it through a spectrogram.

0
source

Source: https://habr.com/ru/post/1381511/


All Articles