# Sound not playing on Windows XP - SoundEffect or Song: Monogame

*Solution:* I have a RealTek ALC888. I solved this (OpenAL) by disabling hardware acceleration on my sound (Control Panel > Sound > Advanced, disable acceleration).

I'm trying to integrate sound into my Monogame game. I don't have the content pipeline hack -- just straight Monogame (Beta 3) at this point.

(I tried adding the content pipeline, but ran into some issues.)

I added a .wav file to my /Content directory, and I can create and instantiate both SoundEffect and Song classes. However, both show durations of 00:00:00 (on a ten-second long file), and neither plays.

I can call LoadContent without any issue. But when I call Play, nothing plays.

I've tried a couple of different sounds, and different formats (MP3 and WAV) to rule that out. Only WAV seems to even load without crashing out, but it doesn't play.

This issue only occurs on Windows XP. I tested it on a Windows 7 laptop, and the sound plays fine.

Edit: I opened a MonoGame issue to track this, and it includes several more details.

• Why don't you use plain XNA for the Windows builds of your game? – r2d2rigo Dec 1 '12 at 13:56
• @r2d2rigo I don't trust that MS will support XNA moving forward. Monogame lets me run on Windows 8, plus I can include Android and iPhone once I buy the licenses. – ashes999 Dec 1 '12 at 15:26
• If the problem is fixed in 3.0... why not use 3.0? – Jari Komppa Dec 5 '12 at 10:16
• @JariKomppa sorry, I forgot to delete that. It's not fixed in 3.0, a different issue is. – ashes999 Dec 5 '12 at 18:42
• Was MonoGame compiled in Windows XP? Or are you just running what was compiled in Windows 7 in XP? If you haven't tried it already, compile MonoGame itself in Windows XP. – Vite Falcon Dec 6 '12 at 18:07

It seems as though I am not the only one with problems getting MonoGame to run sounds on XP:

A very simple alternative is using SoundEffect SoundEffectInstance classes. It is incredibly easy to modify your Windows XACT code to use SoundEffect SoundEffectInstance, HOWEVER, I personally have had problems getting SoundEffect/SoundEffectInstance to work correctly under Windows XP where as XACT works just fine. So I decided to leave XACT on my Windows game and just use SoundEffect/SoundEffectInstance on Mac.

(Emphasis mine.) Based on this, I can safely assume that MonoGame/XP is broken for audio. Unfortunately, Steam's hardware survey frequently cites around 10% of their user-base uses XP. So it's vital to support it.

To make this work, I has a sad. I already have my game/framework code both split by platform (Windows and Android). I added NAudio to the Windows side, along with this lovely OGG player for NAudio.

To get my framework code to be uniform, I:

• Created an interface on top of XNA's SoundEffect class
• Created my own NAudioSoundEffect and XnaSoundEffect classes (former wraps NAudio, the latter wraps the XNA SoundEffect class)
• Use Ninject to inject a factory by platform. It returns the correct sound effect class (XnaSoundEffect on all platforms except windows, which gets NAudioSoundEffect)

The solution allowed me to have a single AudioComponent class with an ISoundEffect instance, internally, which is platform-specific. And it works.

• Have you considered sending a pull request to the MonoGame team? – Vaughan Hilts Feb 4 '13 at 0:56
• @VaughanHilts why would they be interested in my change? I put everything (eg. SpriteBatch, Texture2D) behind interfaces, wrote filler code, and did a bunch of other "major" changes they might not approve of. – ashes999 Feb 4 '13 at 2:42