This project has moved. For the latest updates, please go here.

WaveOutEvent stops playing sound after some hours of playing

Jul 28, 2012 at 8:29 AM


I have a problem with this great package.

I need to play some generated sounds without stop for some days. I used a WaveOutEvent instance, WaveMixerStream32 and BufferedWaveProvider. Every thing is great, but after some hours of playing, audio will stop (I mean I don't hear anything) and the problem exists until I close the program and run it again. I'm pretty sure that It's not related to my program, because I checked it with debugger and found that my program is still writing sound to the provider, but there's no sound out. I should say that my application is something like this: program will initialize a WaveOutEvent and a WaveMixerStream32 and some BufferedWaveProviders at the first of running and never close or stop them until the program closes by user(It means I should have sounds forever if user never stop it). 

It was really a big shock when I faced this problem. Because my project is at final steps.

Please help me.

Thanks in advance

Jul 30, 2012 at 3:05 PM

that is strange. Is the Read method of the BufferedWaveprovider still being called when the sound stops playing? Did you get a PlaybackStopped event at any point?

Aug 11, 2012 at 5:44 AM
Edited Aug 11, 2012 at 6:19 AM

Sorry for delay. it's a little time consuming to catch the problem because it happens after lots of hours.

I did some tests. The PlaybackThread in WaveOutEvent is still alive, but the Read function of BufferedWaveProvider doesn't call.

I write my initialization code, may it helps:


BufferedWaveProvider waveProvider;

WaveFormat wf = new WaveFormat(8000, 16, 1);

waveProvider = new BufferedWaveProvider(wf);
waveProvider.DiscardOnBufferOverflow = true;

WaveProviderToWaveStream wpws = new  WaveProviderToWaveStream(waveProvider);

WaveOffsetStream wos = new WaveOffsetStream(wpws);

waveChan32 = new WaveChannel32(wos);

WaveMixerStream32 mixer;

mixer = new WaveMixerStream32();
mixer.AutoStop = false;



I just should say that I add about 30 waveProvider in my mixer and the Read function of none of them will call after this problem.

Also I should say that I tested it on various PC's with different sound cards.

Aug 13, 2012 at 10:35 AM

I found a new thing. When the problem occurs, the Read function of WaveMixerStream32 is calling but the Read function of WaveChannel32 (which should call from WaveMixerStream32) is not calling. Before the problem, it calls correctly.

Please help

Aug 19, 2012 at 8:42 AM

I don't know what was my problem for, but I used MixingWaveProvider32 instead of WaveMixerStream32 and the problem solved. But I still like to find what was the problem of the previous method.


Aug 27, 2012 at 9:20 PM

You probably don't need to use WaveOffsetStream which might simplify your code a bit. Are there any actions happening on other threads (such as changing position)? There could be threading issues if Read is called on a different thread to a reposition.