Screencast: Creating a WAV File Resampler with NAudio
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.
Want to get up to speed with the the fundamentals principles of digital audio and how to got about writing audio applications with NAudio? Be sure to check out my Pluralsight courses, Digital Audio Fundamentals, and Audio Programming with NAudio.
I just want to know, what is the data that is stored in the byte buffer when you read?
Is this data from the 'time domain' of the wav file?
yes, it contains the samples (2 bytes per 16 bit sample)Mark H