Needham
Needham

Reputation: 467

Playing an mp3 sound in a c# console Application

I have a connect four game which is fully completed, but to learn new stuff im trying to add sounds for when the counter drops in the hole, I cant understand why i keep getting FileNotFound exceptions when i have imported my sounds file to be both in the solution and in the debug file.

this keep crashing:

(new SoundPlayer("Clonk.mp3")).Play();

I have also tried .PlaySync() which gave me the same result

thanks guys!

Upvotes: 4

Views: 1948

Answers (1)

Patrick Magee
Patrick Magee

Reputation: 2989

The SoundPlayer only supports certain .wav files. Try converting your .mp3 file into a .wav and see if this fixes the problem for you.

System.Media.SoundPlayer(string wav).Play();

Upvotes: 2

Related Questions