3

I'm trying to load sound into my game. I downloaded an .mp3 sound (a second long) and tried to load it both as Song and as SoundEffect, but it didn't work, so I tried loading the same sound but as .wav and I was able to load it as a SoundEffect. The problem is that the sound that is coming out sounds like static noise.
I looked a bit into this and found out I need to load sounds as .xnb files, so I downloaded "XNAContentCompiler" project and tried to compile the sounds causing a PInvokeStackImbalance error.

So I found this thread: http://xboxforums.create.msdn.com/forums/p/65519/65519.aspx

Saying I can ignore this and continue.

The xnb file fails to be created when I try to convert the .wav files, saying it is 24-bit audio and I may only use 8 to 16 bit. So I tried to compile the .mp3 file and it succeed, creating a 1k file that I still cannot load not as a Song and not as SoundEffect.

I'm now completely lost on this and can no longer understand what I need to try to load and what is a different problem completely, and I would love some explanations.

pinckerman
  • 4,115
  • 6
  • 33
  • 42
kingblade
  • 113
  • 2
  • 6

1 Answers1

2

Audio files, as any content file, needs to be converted using the XNA Content Pipeline, it's easier if you use a Visual Studio 2010 version with XNA installed in it to convert your contents, so you can copy that .xnb file in your Monogame project.
I think you already know that you have to change its properies to "Copy always" and "Content" to use it in Monogame.

If your problem is the bit resolution, you can always use an audio converter, you can find them online, too.
Anyway, it's better if you use .mp3 as Song and .wav as SoundEffect.

pinckerman
  • 4,115
  • 6
  • 33
  • 42