0
\$\begingroup\$

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.

\$\endgroup\$
  • \$\begingroup\$ In case you are on windows, you could just use the windows (phone) content project, add the files, build the solution and finally compile the solution, but I think you aren't because you wouldn't use Mono then (unless you use windows 8). \$\endgroup\$ – jalgames Sep 27 '13 at 14:25
  • \$\begingroup\$ I am on widows 7 and Im using mono so I will be able to compile it to any platform I want. And I guess I can try that out, but I'm still lost on what I should put in the content folder after the resources are processed, just the xnb files? \$\endgroup\$ – kingblade Sep 27 '13 at 15:24
  • \$\begingroup\$ If everything works fine, then somewhere in your project there is a directory with all the xnb files inside. The easiest way of finding it is to simply search ".xnb" in Windows Explorer. When adding the files to your content folder, make sure to set "Copy to output directory" to "Copy if newer" so the game has the graphics when you distribute it. \$\endgroup\$ – jalgames Sep 28 '13 at 6:51
1
\$\begingroup\$

I was experimenting with monogame and noticed that ,the xna content pipeline creates .wma file and .xnb file in the output directory for each mp3 i compile. I can get the song to play on my windows 8 project only if i copy both the .wav and .xnb to the content directory.

\$\endgroup\$
  • \$\begingroup\$ You may youse this tool to quickly convert to xnb and audio files. 1drv.ms/1drPvzv . it uses ffmpeg and xnxcontentcompiler \$\endgroup\$ – Sidney Mar 25 '14 at 11:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.