SoundEffects Distort or Don't Play After a While

I’m working on a Windows 8.1 Windows Store game and have noticed a problem with SoundEffects.

Throughout the game, the player defeats many enemies, and they each play the same sound when defeated. I play these sounds using SoundEffect.Play(). On the later levels (Level 30+), the player will kill roughly 150-200 enemies, and at around Level 38 all sounds and music (which is played using SoundEffectInstance) get distorted or sometimes stop playing entirely. I minimized the game and looked at Task Manager, and I saw the game taking up roughly 169 MB (pretty normal) and using up roughly 30% of my CPU when it normally uses up around 1-2%. SoundEffect.Play() was always returning true, so I don’t think I’m playing too many sounds at any given time.

I managed to replicate the issue by playing the same sound 10 times each frame in Game1.Update(). After roughly 8-10 seconds, the sounds and music distorted once again.

Has anyone else encountered this issue? Another topic talks about memory leak with SoundEffects on Windows Phone, but it seems that the fix has not actually been implemented; I suspect this memory leak is what is happening to me: SoundEffect loaded via ContentManager causing memory leak after resume

All help is greatly appreciated!

EDIT: Has anyone else experienced this bug?

I posted an issue on GitHub about this. You can find it here:

I have the same problem when playing shot sounds (using SoundEffect.CreateInstance) each ~100ms. After ~1min you can hear distortion and it then just gets worse.

I’m running on a Windows Phone 8.1 - Nokia Lumia 920.
The shot sound is 16-bit stereo, 22khz and 650ms long. (I’ve also tried other formats (8-bit, 11khz, 44khz etc))
The .XNB file is generated with the pipeline.exe tool
I’ve used MonoGame 3.2 NuGet dll:s as well as built from the development branch
I’ve disabled all other sounds so there’s only the shot sound playing

I’ve just ported the game from XNA and this was not an issue there.

Did you find a solution to this problem?
Where you launching too many soundeffect at once?
I’m having a similar issue on windows phone…

I am using raw wav files, but I have not experienced anything like that. Is it happening only when playing 8-10 files at once, or playing one long wav for a while?

Im playing wma songs and xnb effects over the music. Could it be the fact that i’m using the Monogame.WP version instead than the Monogame.WP81 version?
[Using last github commits]

Unfortunately I have not found a fix for this issue yet. I believe it is clearly a bug on MonoGame’s part.


somebody with the problem could confirm the workaround posted here?

In the same exact situation, same exact code, the Wp7 xna counterpart plays like magic. To me it seems like an issue with lag or maybe not giving the soundeffect enough time to fill the buffer… in this case it could be possible to test with some sample waves, a mic and audacity.