No Sound From MP3 Files On Windows Phone

Hi,

Sorry for my bombardment but I think I’m almost done porting!

I have WAV files loading and playing fine for fx using SoundEffectInstance.

In my game I play background music using MediaPlayer and Song but I am getting no audio from these on the phone. No errors either, content appears to load fine just no audio! Working fine on iOS and Android.

Just wondered if anyone had any pointers…

MP3s are pretty standard format I believe - 128kbps/16bit/44khz

cheers

OK, the problem is clearly in the xnb conversion - the xnb files that are created by the xna content compiler I’m using are 1kb in size!

As far as I know you can directly load music files without an XNB, as the XNB only contains a reference to the path of the music file (which is usually converted to WMA by XNA).

Be careful with MP3 files. Do not use the format for distribution.

I can’t get loading of ‘raw’ mp3 files to work at all.

I have used the MG Pipeline Tool to convert my mp3 files - it seems to create an .xnb file and a .wma file. I finally figured out that these have to be in the same path from the Pipeline project as they are when loaded in-game and if I import the .wma and the .xnb I can get something to play.

However, it seems to be extremely flakey. Volume levels are all over the place and some files just aren’t playing at all for no apparent reason. Code works fine on iOS and Android.

Write once play anywhere my arse!

OK, well it seems the files are actually playing - it’s just that problems with setting the volume made it seem like they weren’t.

Weirdness:

  1. Volume curve for MediaPlayer seems to be vastly different to the volume curve for SoundEffectInstance. Set MediaPlayer to a volume level of 0.5 and it’s barely audible.

  2. Increasing the volume of MediaPlayer causes a seemingly random song to start playing even if the MediaPlayer is paused. Decreasing the volume is fine!