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.
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.
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.