Search code examples
c#.netaudiowavpcm

Play PCM data in .NET Framework 2?


I have a stream of u-Law compressed PCM data I am extracting from a Camera, I need to play this out the speakers? Anybody know how? I've tried decoding the u-Law into normal WAV Data and then use SoundPlayer but it never seems to work! Always SoundPlayer only supports PCM Data?

I know the sounds ok, because I have saved it to a file (using a custom createWavHeader method) and iTunes can play it.


Solution

  • Windows comes with an ACM codec to convert u-law to PCM. You can use NAudio and use the WaveFileReader and the WaveFormatConversionStream to get a PCM stream you can play easily.