Stripping WAV (RIFF) files

I've been organizing my music recently, and I ran into a couple of old WAV format MP3s. Not all software can deal with WAVs, and since MP3 files are simply the raw MPEG-Layer 3 audio stream, I decided to make a simple program that extracts the audio data from a WAV (RIFF) file.

A WAV file is basically an RIFF, like an RIFF file it consist of multiple tagged blocks, called chunks, that start with a four letter (ASCII) "ID" (tag) and a 32 bit chunk length field. Later versions of WAV have additional information and a feature to record more than 4GB of data per file, but those features are irrelevant for my goals. The basic WAV file consists single RIFF chunck that has an "fmt" chunk and a "data" chunk. The data chunk contains the actual audio data, and is all I'm interested in. The program scans the chunks in the file until it finds the "data" chunk, then it copies the information in the data chunk to a new file.

The source code for this program can be downloaded from the downloads section, it's a microsoft Visual Studio 2010 project.

Posted: 2013-02-13 keywords: programming, file formats