I'm making a XNA 4.0 game, and I'm using NAudio for playing sounds because it is more powerful than XNA's Sound module.
I need to play a MP3 file slower (either at 0.75x or 0.5x speed). My original idea was to change the Sample Rate of the WaveStream. Here is what I'm trying to do:
WaveStream originalWaveStream = new MP3FileReader(filepath);
WaveChannel32 volumeStream = new WaveChannel32(originalWaveStream); //So I can change the volume of the playback
WaveFormat tempFormat = new WaveFormat((int)(volumeStream.WaveFormat.SampleRate * 0.75f),(int)volumeStream.WaveFormat.BitsPerSample,(int)volumeStream.WaveFormat.Channels);
WaveFormatConversionStream tempStream = new WaveFormatConversionStream(tempFormat, volumeStream);
WaveChannel32 slowerWaveStream = new WaveChannel32(tempStream);
If I run this, I get an MmException that says "AcmNotPossible calling acmStreamOpen" when the tempStream's constructor is running.
What I am doing wrong? Is changing the Sample Rate the only way to change the playback speed? Is there a correct way to do it?