PCM (Pulse-code modulation) is an uncompressed audio format. We take the Wav file, which contains the PCM data. How do see
What is a Wave file? Method
AudioCompressionManager.GetWaveFormat can look inside the audio format.
FormatTag = 1 for PCM.
Channels = 1 for mono, 2 stereo, 8 for 7.1 Surround Sound (left, right, center, left surround, right surround, left rear, right rear positions. 7.1 systems also have 1 channel for LFE (low frequency effects) which is usually sent to a subwoofer).
SamplesPerSec = number of digitized values in the second (or sampling). Could be anything, but the standard values: 8000 Hz, 11025 Hz, 12000 Hz, 16000 Hz, 22050 Hz, 24000 Hz, 32000 Hz, 44100 Hz, 48000 Hz.
BitsPerSample = most common uses 8 bits (1 byte) and 16 bits (2 bytes). Rarely 24 bits (3 bytes), 32 bits (4 bytes) and 64 bits (4 bytes). If we consider the 16 bit as a base, then 8 bits can be considered as a compressed format. It requires two times less space, but the options values can be only 28 = 256 instead of 216 = 65536 for 16 bits. Therefore, 8 bits sound quality will be significantly lower than 16 bits.
BlockAlign = Channels * BitsPerSample / 8. Where 8 is the number of bits per byte.
AvgBytesPerSec (bitrate) = Channels * SamplesPerSec * BitsPerSample / 8.
The code below can be used to see PCM audio format in more detail.
private void WhatIsPcmFormat(string fileName)
{
WaveReader wr = new WaveReader(File.OpenRead(fileName));
IntPtr format = wr.ReadFormat();
wr.Close();
WaveFormat wf = AudioCompressionManager.GetWaveFormat(format);
if (wf.wFormatTag == AudioCompressionManager.PcmFormatTag)
{
int bitsPerByte = 8;
Console.WriteLine("Channels: {0}, SamplesPerSec: {1}, BitsPerSample: {2}, BlockAlignIsEqual: {3}, BytesPerSecIsEqual: {4}", wf.nChannels, wf.nSamplesPerSec, wf.wBitsPerSample, (wf.nChannels * wf.wBitsPerSample) / bitsPerByte == wf.nBlockAlign, (int)(wf.nChannels * wf.nSamplesPerSec * wf.wBitsPerSample) / bitsPerByte == wf.nAvgBytesPerSec);
}
}