Problems with loading music

Whenever I try loading a song for a Song variable, it can’t find it. The format of the file is .mp3, and it’s in the Content pipeline.

song = Content.Load(“will.mp3”);

states that…

SharpDXException was unhandled
An unhandled exception of type ‘SharpDX.SharpDXException’ occurred in SharpDX.dll

Additional information: HRESULT:[0x80070002], Module: [Unknown], ApiCode: [Unknown, Unknown], Message: The system cannot find the file specified.

Hi, welcome :slight_smile:

You dont need the file extension in the path (.mp3)…

Other than that, you need to use the pipeline tool, to build the mp3 file into a pair of files: a songName.wma and songName.xnb, and then include THOSE files instead.

It can seem like a hassle, but once it works, it works…

I changed the file from mp3 to a wma, and the same error is still there. I looked through the project files in file explorer and the file is converted to xnb with the wma version, but it supposedly still can’t find it.

hmm… I just did a clean test run, and this works:

It requires one mp3 file somewhere on your computer:

In the solution explorer, open the content folder and double click content.mgcb

the pipeline tool opens… Click button 5, “add existing item”, and browse to and select your mp3 file…

then, in the main tool window, select build from the build menu… Save when prompted.

This process imports your mp3 file as the 2 files automatically…

Still doesn’t work, it still can’t find the file. The file is indeed inside the content.mgcb and is built. Could the error lie within the code?

sure could… :slight_smile: If you could post your loading code, I’ll look.

should be like this:
musicTrack = content.Load<Song>(".\\Sounds\\VectorSong");

or in your case

song = content.Load<Song>(".\\will");


using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Media;

namespace Sound
public class Game1 : Game
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
Song song;

    public Game1()
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";

    protected override void Initialize()

    protected override void LoadContent()
        spriteBatch = new SpriteBatch(GraphicsDevice);
        song = Content.Load<Song>("will");

    protected override void UnloadContent()

    protected override void Update(GameTime gameTime)

    protected override void Draw(GameTime gameTime)



should be
song = Content.Load<Song>(".\\will");

you need that dot slash slash

or I think you can use:
song = Content.Load(@“will”);

I tried both, the (".\will") and (@“will”) and it still can’t find the file.

For some strange reason I read through this a few times and thought…

1 - Probably a typo somewhere…

2 - Could be a faulty random disk read issue… or bad RAM…

3 - Something system related…

4 - Not Admin user!?

For 2 try this

Go to the /bin directory of your project and look if both will.xnb & will.wma files are there.
I mean the directory where your .executable is, it should be “Bin/Debug/Content” “Bin/Release/Content” or something similar.

1 Like

I followed what @nkast stated and noticed that only the .xnb is in the /bin directory of my project, not the .wma. Any way to fix this?

In VS look at the Properties pane with the file selected, and make sure it is ‘Copy if newer’

If you create a project from templates it has a /content folder and a content.mgcb file with it’s action is set to ‘MonoGameContentReference’.
Any asset you add to that .mgcb will be automatically copied to the output directory.

There are other ways that require editing your project file or manually coping assets and include them as resources, but the above is the is easiest method. Do you have this in your project? If you used some old sample as your starting point you might not. It’s easy to to add it, Let us know what’s the situation and how you currently include that .mp3.

1 Like

Oooooh :scream:

I forgot to check that…