I realized it is bad for me to neglect this thought, because I haven't read anything about number of channels
and bits per sample
in this light. My reason is that I'm not sure how the samples of 2-channel 8-bit PCM files will look like.
Is it 1 sample = 1 channel
? or 1 sample = 4 bits (left) + 4 bits (right)
Context: I am writing a program that reads WAV files, and it occurred to me that if I come across 8-bit PCM WAV files, and my code reads this way (see below), then my program is unable to properly read multi-channel 8-bit PCM WAV files.
// read actual audio data after obtaining
// the headers
// audioData is a vector of vectors (1 vector per channel)
uint32_t temp;
while( !feof(wavFile) ) {
for(uint16_t i = 0; i < numChannels; i++) {
temp = 0;
fread(&temp,sizeof(uint8_t),1,wavFile);
audioData.at(i).push_back(temp);
}
}