2
\$\begingroup\$

I'm trying to add a music file to my project, but I get the error "Could not load EpicScores.wav asset!"

I load the music file like this:

Song sound1 = Content.Load<Song>(@"EpicScoreCreatorOfWorlds.wav"); 

I've tried both with and without the .wav ending.

My file is added to the Content folder, and I've made sure my file properties are set to the "Content" build action and to "copy always."

Why do I get this error and how can I fix it?

\$\endgroup\$
  • \$\begingroup\$ Don't pass the extension. \$\endgroup\$ – Grey Jan 26 '14 at 0:14
  • \$\begingroup\$ Still dont work, same error. \$\endgroup\$ – Thomas Wiborg Jan 26 '14 at 0:20
  • \$\begingroup\$ monogame.codeplex.com/discussions/457268 Looks like you may have to edit some MonoGame source to get it to work. \$\endgroup\$ – Grey Jan 26 '14 at 0:23
  • \$\begingroup\$ How is it possible to edit the source? \$\endgroup\$ – Thomas Wiborg Jan 26 '14 at 0:46
  • \$\begingroup\$ The code is on GitHub but it sounds like you actually don't want to implement the "fix" since it's incorrect per one of the maintainers; if you do it you will create a divergence in your local version that will never be resolved upstream, causing headache for you later. \$\endgroup\$ – Josh Jan 26 '14 at 3:22
2
\$\begingroup\$

Per this thread on the MonoGame forums, this appears to the result of a legacy MonoGame feature that allowed the loading of unprocessed .wav files via the content pipeline API without actually using the content pipeline.

You should leverage the content pipeline to load your assets (the content pipeline will transform your assets from their source format to a more suitable runtime format; that's why you don't need the file extension in the load call, because you're actually loading a different kind of file than you'd think).

This involves creating a content project for your content, adding the music asset and setting the content processor for it (as you've previously set the build actions; you probably want MonoGame Song in this case).

\$\endgroup\$
  • 1
    \$\begingroup\$ Yeah, I see. But the problem is getting Content Pipeline to work on VS2013, yet. :) \$\endgroup\$ – Thomas Wiborg Jan 26 '14 at 19:59
1
\$\begingroup\$

http://jaquadro.com/2013/11/migrating-monogame-projects-to-vs2013-and-windows-8-1/

I found out how I can get Content Pipeline to work for Visual Studio 2013, in the above link.

\$\endgroup\$
  • \$\begingroup\$ You should add more to your answer, such as the steps you took. Link die over time. You should then accept your own answer. \$\endgroup\$ – user15805 Feb 9 '14 at 19:08
0
\$\begingroup\$

If i am correct you cannot load .wav files as 'song'. wav files may only be used as 'Sound Effects' .you can convert the file to .wma and then use it.U also have to create .xnb file. For a song to play on windows 8/windows phone ,u have to copy both the wma file and xnb file to the content folder.

Here is a solution that i created by modifying 'Xnacontentcompiler' which is an opensource project.

http://1drv.ms/1drPvzv

run xnacontentcompiler(assuming you have xna4.0). use the format converter to convert file to wma and then create xnb file for that wma. now copy both the xnb and wma to your content folder,change property to content and copy always and load the file like you normally do.

\$\endgroup\$

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.