C# WAV FILE CLASS


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. Hello Bill Gates, with much respect, really, but File Size still is a wrong value - it should be +8 bytes indeed.

It was originally intended for a tiny 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 audio 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 anyone can see what actually happens in it. It reads and writes 8-bit / 16-bit / 24-bit / 32-bit stereo audio files. It can be easily modified to process 5.1 surround audio files too, but I don’t actually need to do this because all my CD copies have 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. Here is my source code:



				
16916