I have a web application that returns a byte [] from a wav file in the browser, however I need to convert these audio files to .mp3, I tried to use the Naudio library for this and I could not.
I try to use this code:
public static byte[] ConvertWavToMp3(byte[] wavFile)
{
using(var retMs = new MemoryStream())
using (var ms = new MemoryStream(wavFile))
using(var rdr = new WaveFileReader(ms))
using (var wtr = new LameMP3FileWriter(retMs, rdr.WaveFormat, 128))
{
rdr.CopyTo(wtr);
return retMs.ToArray();
}
}
It's return an error :
Unsupported encoding format ALaw Parameter name: format