WAV, known for WAVE (Waveform Audio File Format), is a subset of Microsoft’s Resource Interchange File Format (RIFF) specification for storing digital audio files. The format doesn’t apply any compression to the bitstream and stores the audio recordings with different sampling rates and bitrates. It has been and is one of the standard format for audio CDs. Wave files are larger in size as compared to new audio file formats such as MP3 which uses lossy compression to reduce the file size while maintaining the same audio quality. However, WAV files can be compressed using Audio Compression Manager (ACM) codecs. There are several APIs and applications available that can convert WAV files to other popular audio file formats.
WAV File Format
The WAVE file format, being a subset of Microsoft’s RIFF specification, starts with a file header followed by a sequence of data chunks. A WAVE file has a single “WAVE” chunk which consists of two sub-chunks:
a “fmt” chunk - specifies the data format
a “data” chunk - contains the actual sample data
WAV File Header
The header of a WAV (RIFF) file is 44 bytes long and has the following format:
1 - 4
Marks the file as a riff file. Characters are each 1 byte long.
5 - 8
File size (integer)
Size of the overall file - 8 bytes, in bytes (32-bit integer). Typically, you’d fill this in after creation.
File Type Header. For our purposes, it always equals “WAVE”.
Format chunk marker. Includes trailing null
Length of format data as listed above
Type of format (1 is PCM) - 2 byte integer
Number of Channels - 2 byte integer
Sample Rate - 32 byte integer. Common values are 44100 (CD), 48000 (DAT). Sample Rate = Number of Samples per second, or Hertz.
(Sample Rate * BitsPerSample * Channels) / 8.
(BitsPerSample * Channels) / 8.1 - 8 bit mono2 - 8 bit stereo/16 bit mono4 - 16 bit stereo
Bits per sample
“data” chunk header. Marks the beginning of the data section.
File size (data)
Size of the data section.
Sample values are given above for a 16-bit stereo source.