To give a feel for just how simple it is to use NAudio for WAV file processing, I have made a short screencast demonstrating how to make a command line WAV file resampler. This uses the new
ResamplerDmoStream that I have been making reading for the next release of NAudio. You can get it if you download the latest code from CodePlex.
To make the screencast, I used the very impressive Jing utility, which currently limits you to five minute screen captures, so it is in two parts (if you are having trouble viewing the files embedded on this page, try these links: Part 1, Part 2)...
- I did actually check the resulting WAV files to make sure they played OK!
- I have not yet explored the boundaries of the Resampler DMO object, so I can't guarantee changing bit depths and channel counts will necessarily work
- To resample to IEEE floating point format requires you to use an IEEE WaveFormat for the output. You can't just set a bit depth of 32.
- We could have made the code even more succinct had I used the
WaveFileWriter.CreateWaveFilestatic method which would take the resampler stream and the wave output filename as an input, thus reducing our application to a mere three lines of code.