Audio Distortion After Playing

I’m back with another question. I’m trying to play SoundEffects and I’ve noticed that after each time a sound effect has played, there’s noise after it. I’ve used this sound file in other places so I know its not the file, but I’m not sure why this is happening.

Using which platform? We support both XAudio2 and OpenAL, and it might even be hardware dependent, so the more information we have, the better chance we have of narrowing down the problem area.

Its XAudio2 because this is a DirectX Windows game project. I don’t know what else to really give, I have a very simple sound system with two functions, one that loads a sound into a list, and then another function to play a specified sound from the list of loaded sounds.

It doesn’t matter how frequently I play the sounds, the noise still occurs.

We use the DirectX11 version for a large game with lots of sound effects and have not heard this. Are you able to supply a small sample project that demonstrates the issue? Include the source WAV file as well.

The key files to look at are Objects/Sounds/SoundEffectManager.cs, and GameTest/BossSingleTest1.cs.

[Project Link][1]
[1]: https://www.dropbox.com/s/rlb5xf15i4gydm7/DanmakuEngine.zip?dl=0

Is the distortion the same or does it get worse and worse over time? Are you using SoundEffect or SoundEffectInstance? I have noticed a problem in the latest version of MonoGame (and maybe older ones) where playing the same SoundEffect over and over eventually results in distortion on my Win8 tablet. I switched to SoundEffectInstance and it all went away. There may be a memory leak somewhere.

The problem occurs the first time the sound is used. However I did notice it getting worse over time. I also tried converting the SoundEffect object to a SoundEffectInstance using the method but that didn’t work either. Is that the same thing as creating a native SoundEffectInstance? Or is the problem simply transferred over?

Well for what it’s worth you may want to use a SoundEffectInstance to prevent the sound effect from getting worse over time. I know this doesn’t answer your original question but it might be something you’d run into even if you did solve the original problem.

Thank you, any help is greatly appreciated. Well if no one can find a solution, I guess I’ll have to implement another audio library.

Does anyone have a solution? I was asked to provide a sample, which I did, but I got no reply. This bug is kinda holding me up so a response is greatly appreciated.

Sorry. Work life has gotten in the way of a lot of MonoGame dev recently. I’ll try to have a look at it tonight.

Thank you, I hope you will be able to figure out the problem.

I put your se_tan00.wav into a small test project that simply loaded the sound, both as a processed xnb and as a raw wav, and plays the sounds on keypresses. I tried it using SoundEffect.Play() and SoundEffectInstance.Play() (after creating an instance), and couldn’t hear any extra noise at the end of the sound.

Does the noise happen if you run my project? Can I see the test project you made to make sure I didn’t do anything wrong?

I can’t build your test project as it is missing two FBX handler projects.

My test was a new project created from a template.

Add to the top of the Game1 class

SoundEffect _sound;

Add to Game1.LoadContent

_sound = Content.Load<SoundEffect>("se_tan00");

In Game1.Update

if ( <key pressed or mouse button clicked> )
    _sound.Play();

Alright I’ll try creating a new project and hopefully it works.