I would like to know if it is possible to convert mp3 to wave using nAudio library but without saving converted file to disc (using for example MemoeryStream) ?
Any examples?
I tried like this:
byte[] fileStream = null;
MemoryStream ms2 = new MemoryStream();
using (WaveStream waveStream = WaveFormatConversionStream.CreatePcmStream(newMp3FileReader(filePath)))
using (WaveFileWriter waveFileWriter = new WaveFileWriter(ms2,waveStream.WaveFormat))
{
byte[] bytes3 = new byte[waveStream.Length];
waveStream.Position = 0;
waveStream.Read(bytes3, 0, (int)waveStream.Length);
waveFileWriter.Write(bytes3, 0, bytes3.Length);
fileStream = bytes3;
return fileStream;
}
When I saved file from byte array it is damaged. Screen: