0
votes

I'm currently trying to learn about how WAV files are processed and stored. Most of the resources I've looked at clearly explain how the head chunk is processed, but not the data (this is the one I've found the most helpful). From the WAV file I'm inspecting I get:

NumChannels = 2
SampleRate = 44100
BitsPerSample = 16
Subchunk2Size = 2056192 (11.65s audio file).
NumSamples = 514048

So from my understanding, 44100 samples are played in a second and each sample is 16-bits. There is a total of 514048 samples in this recording. But what about the number of channels? How does that effect reading the data? The resource I mentioned shows: enter image description here

But I don't quite understand what this means. Isn't this showing a sample being 32-bit? And what about the right and left channels? Wouldn't they alternate? Why are they in groups of 2 before changing to the other channel?

1

1 Answers

1
votes

The diagram is somewhat unclear, but this is what I understand from it, plus the other information you gave:

  • each ellipse contains 16 bits (two bytes, four hex digits), so one sample;
  • there are pairs of samples;
  • the label "right channel samples" points to the right-hand sample of each pair;
  • similarly, "left channel samples" points to the left-hand samples.

So it looks to me that the left and right channel samples do alternate.

As for the numbering, I guess the intent was to show that the first pair of samples are each "sample 2" in their respective channels, followed by a pair that are "sample 3", and so on. I would have labelled them "sample pair 2" etc.