given that I have a .wav file, what would be best way to read its Bit rate property in C#. I have tried Shell, and asked a question Is "Bit rate" property fixed i
With NAudio, the bitrate is calculated via the AverageBytesPerSecond member of the WaveFormat structure:
using (var reader = new WaveFileReader(filename))
{
bitrate = reader.WaveFormat.AverageBytesPerSecond * 8;
}
This will work for all uncompressed audio formats and most compressed. The WAV file format is a container format and can actually contain audio in any codec, even though it's most common use is PCM. But not all codecs are CBR (constant bit rate). Some have a variable bit rate, so the AverageBytesPerSecond property may be an estimate.