tags:

views:

188

answers:

2

/want to put a musical easter egg into my app

The SoundPlayer code below seems to only like mp3s :-(

       Stream stream = new MemoryStream(Properties.Resources.MyMp3, false);
        using (SoundPlayer player = new SoundPlayer(stream))
        {
            player.PlaySync();
        }

Thanks

+2  A: 

You could use the Windows Multimedia API.

See this page.

Francis B.
+1  A: 

SoundPlayer only supports .wav files. You have two options:

  1. Use another method, such as the one mentioned by Francis B
  2. Convert the MP3 to a wav

As this is internal to your application, I'd convert it to a wav and use SoundPlayer to play it. The conversion will be a one-time process, so this is really the simplest solution.

adrianbanks
How do i convert the MP3 to a wav? thanks
JoeyJackson
WinLame is easy to use and quickly convert files between MP3/WAV/WMA
Rodrigo
Audacity (http://audacity.sourceforge.net/) can do it as well.
adrianbanks