Mariusz
Mariusz

Reputation: 481

What do sample bytes in raw audio files mean?

Yes, I know - e.g. in 16bit signed integer, every 2 bytes represent a "sample" which is an integer from -32768 to 32767, but I don't understand, and can't find information, what is the mapping between actual values and sounds (sound wave parameters, to be exact). Could anyone explain it to me or point me somewhere?

Upvotes: 0

Views: 1960

Answers (1)

Florian
Florian

Reputation: 5994

If you visualize a sound wave, it is a curve in form of a line. And as we all know, a line consists out of infinite points. Since a hard drive is limited in space, it can't store infinite points. It just can store a few points. So what can we do? We just take out a few points of this "line" and store them. And each of these points is a sample. It is the displacement of the audio wave at a specific time. So if you've got a sound like this:

copied from audacity tutorial
(source: sourceforge.net)

A computer can't store the whole wave. It will take out a few points of that wave and store them. And how many points he takes out for storing one second is measured by the samplerate. The higher the samplerate is the higher is the quality of the sound. If the samplerate would be an infinite number, the quality would be nearly as good as the original wave. But why just nearly? Thats because a computer uses 8, 16, 24, 32,... whatever bits to store one sample. The more bits he uses to store one sample the better the quality is. As a result, we can say that in theory, the quality of a sound would be as good as the original sound, if the samplerate would be infinite AND the amount of bits, used to store one sample, would be infinite.

Upvotes: 2

Related Questions