You can use resource string:
var music = Properties.Resources.punchSound;
And then use SoundPlayer like this:
var player = new SoundPlayer(new MemoryStream(music));
Question
I have stored an audio file in the resources folder of my application but when I use the below path I get a file no found exception.
Can someone explain if this is the correct way to reference a file in resources or if I need to set the path differently?
This is the code that take the audio file as a parameter:
SoundPlayer player = new SoundPlayer("Resources/Audio/punchSound.wav");
player.Load();
player.Play();
Solution
You can use resource string:
var music = Properties.Resources.punchSound;
And then use SoundPlayer like this:
var player = new SoundPlayer(new MemoryStream(music));