How to read the data in a wav file to an array

audio, c#, file-io

Solution

WAV files (at least, uncompressed ones) are fairly straightforward. There's a header, then the data follows it.

Here's a great reference: https://ccrma.stanford.edu/courses/422/projects/WaveFormat/ (mirror)

Problem

I need to get all the samples of a wav file into an array (or two if you need to do that to keep the stereo) so that I can apply some modifications to them. I was wondering if this is easily done (preferably without external libraries). I have no experience with reading in sound files, so I don't know much about the subject.

Original source