mercoledì 2 novembre 2011

How to convert raw pcm data into wav files using NAUDIO library

In my project I have a third party library that produces raw PCM files and I need to play them.
Off course tools like Audacity are able to convert PCM files, but the easiest way I found out to read and play raw PCM files programmatically is using NAUDIO:

WaveFormat format = new WaveFormat(8000, 1);
using (RawSourceWaveStream reader = new RawSourceWaveStream(new FileStream (fileName, FileMode.Open), format))
{
 WaveFileWriter.CreateWaveFile(Path.ChangeExtension(fileName, "wav"), reader);
}

Nessun commento:

Posta un commento