This project has moved. For the latest updates, please go here.

Can WaveFormatConversionStream(WaveFormat targetFormat, WaveStream sourceStream) be used to covert from wav to mp3

Sep 18, 2012 at 12:55 PM

My case is to fade in/out a mp3 file. Searched the forum, looks I need to conver it to wav first, after editing, I need to convert the wav back to mp3 again.

I am reading the APIs from NAudio. Wondering if this API can be used for this purpose.

Thanks!

Coordinator
Sep 18, 2012 at 7:51 PM

Yes, you can use NAudio to do most of this. The AudioFileReader class will read the MP3 file. Then use FadeInOutSampleProvider to perform the fade. Then you would convert to WAV file using WaveFileWriter and SampleToWaveProvider16. Finally, you'd need to use something like LAME.exe to re-encode as MP3

Mark

Sep 19, 2012 at 5:23 AM
markheath wrote:

Yes, you can use NAudio to do most of this. The AudioFileReader class will read the MP3 file. Then use FadeInOutSampleProvider to perform the fade. Then you would convert to WAV file using WaveFileWriter and SampleToWaveProvider16. Finally, you'd need to use something like LAME.exe to re-encode as MP3

Mark

Hi Mark,

Which version of release have the APIs you pointed out? I am reading NAudio v1.5 release. But I couldn't find 

. FadeInOutSampleProvider

SampleToWaveProvider16 (Is it NAudio.Wave.WaveProvider16?)

As both wav and mp3 are from WaveStream, can I use WaveFormatConversionStream to convert wav to mp3? I like to stick to NAudio only if possible.

Thanks!

Valimo

Coordinator
Sep 25, 2012 at 6:34 AM

You might need to get the very latest NAudio release either by building the code yourself or visiting the NuGet page and picking up a beta release.

You can't convert WAV to MP3 because Windows does not come with an ACM that can do this. I usually recommend using LAME to do this.