October 2013
Intermediate to advanced
368 pages
9h 20m
English
We can now test-drive our changes to
writeData
to incorporate the number of channels. The channel count represents the number of tracks (sound from separate sources) to play simultaneously. For monaural (mono) output, the channel count is one. For stereo, it is two. Playback of the WAV requires iterating through all the samples in order. A given sample is comprised of a series of subsamples, one per channel. Monaural representation for a four-sample audio clip, where a sample is a single byte, might look like this:
| | AA BB CC DD |
Suppose there is a second channel with the following sample sequence:
| | 01 02 03 04 |
The resulting WAV stream should appear like this:
| | AA 01 BB 02 CC 03 DD 04 |
Here’s a test showing how increasing ...