I am in the process of rewriting my DWA (Digital Waveform Archive) audio data compression program from C++ to C#. Well, first things first. At first, we need to get audio data. I use good old WAV audio file format. This multimedia file format was developed by Microsoft a long time ago. It was intended for very small sound files, but due to its simplicity it is still in use by various audio processing and converting software.

Generally WAV file format consists of some info headers called “chunks”, audio data section and some optional metadata. When writing a program to deal with WAV files it is not required that it should be able to understand every chunk type because that would be impossible. However, it should be able to skip over the unrecognized chunks until it gets to audio data. Audio data is just a sequence of samples, usually 16-bit integer numbers. In case of stereo audio files it just Left channel, Right channel, Left channel, Right channel and so on.

I publish source code of my WAV file processing C# class, so that anyone can see what actually happens in it. It reads and writes 16-bit stereo audio files. It can be easily modified to process 5.1 surround 32-bit audio files too, but I don’t actually need to do this because all my CD copies have exactly 16-bit stereo audio format type.

I plan to publish my source code further when new classes are ready with some short explanation about what they do and finally when rewriting is done I’ll upload the complete project to GitHub.