I agree with Alex. I took the time to put together a small program with three lines of code that print the duration of the wav file.
var stream=new MemoryStream(File.ReadAllBytes("test.wav")); var wave = new WaveFileReader(stream); Console.WriteLine(wave.TotalTime);
Download the NAudio library: you will find NAudio.dll in the package.
Just specify the NAudio.dll file in your project.
At the time of writing release 1.3.
As the author says in his blog, WaveFileReader accepts Stream ; not just the file path.
Remember that version 1.3 is built for x86. If you want it to work on x64, you need to force your project on x86. If you want NAudio.dll for x64 (for example, me), you need to recompile "any processor". For me, both solutions worked like a charm.
source share