Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the actual data in a WAV file?

I'm following the python challenge riddles, and I now need to analyse a wav file. I learn there is a python module that reads the frames, and that these frames are 16bit or 8bit.

What I don't understand, is what does this bits represent? Are these values directly transformed to a voltage applied to the speakers (say via factoring)?

like image 336
Yotam Avatar asked Jan 10 '23 18:01

Yotam


1 Answers

The bits represent the voltage level of an electrical waveform at a specific moment in time.

To convert the electrical representation of a sound wave (an analog signal) into digital data, you sample the waveform at regular intervals, like this:

enter image description here

Each of the blue dots indicates the value of a four-bit number that represents the height of the analog signal at that point in time (the X axis being time, and the Y axis being voltage).

In .WAV files, these points are represented by 8-bit numbers (having 256 different possible values) or 16 bit numbers (having 65536 different possible values). The more bits you have in each number, the greater the accuracy of your digital sampling.

like image 62
Robert Harvey Avatar answered Feb 03 '23 19:02

Robert Harvey