Reputation: 241
The module "wave" of Python gives me a list of hexadecimal bytes, that I can read like numbers. Let's say the frequency of my sample is 11025. Is there a 'header' in those bytes that specify this? I know I can use the wave method to get the frequency, but I want to talk about the .wav file structure. It has a header? If I get those bytes, how do I know which ones are the music and the ones that are information? If I could play these numbers in a speaker 11025 times per second with the intensity from 0 to 255, could I play the sound just like it is in the file?
Thanks!
Upvotes: 0
Views: 144
Reputation: 798486
.wav files are actually RIFF files under the hood. The WAVE
section contains both the format information and the waveform data. Reading the codec, sample rate, sample size, and sample polarity from the format information will allow you to play the waveform data assuming you support the codec used.
Upvotes: 1