This project has moved and is read-only. For the latest updates, please go here.
Playing a WAV

Last edited Dec 30, 2010 at 12:11 PM by OpenSebJ, version 1


wtheronjones Mar 7, 2013 at 8:16 PM 
This worked for me to play a wav file:

using NAudio.Wave;
var soundFile = "Something.wav";
using (var wfr = new WaveFileReader(soundFile))
using (WaveChannel32 wc = new WaveChannel32(wfr) {PadWithZeroes = false})
using (var audioOutput = new DirectSoundOut())


while (audioOutput.PlaybackState != PlaybackState.Stopped)


In this case, the PlaybackStopped event was raised, but I guess it's not good to count on that.

This would work when running as a service on Windows 7.

wtheronjones Mar 2, 2013 at 1:32 AM 
Could someone be a lamb and post a sample? I need to play a WAV file from a Windows Service on Windows 7 and this is supposed to be the solution to my problems.

jjxtra Feb 13, 2013 at 1:35 AM 
So... is this page going to be updated ever?