This project has moved and is read-only. For the latest updates, please go here.

From WaveIn To SampleProvider to WaveOut

Apr 17, 2013 at 8:39 AM
Edited Apr 17, 2013 at 8:39 AM

Could you provide a skeletton (C#) for :
  • Wave In to sampleprovider chain to wave out
  • Filereader to sampleprovider chain to waveout
  • wavein to sampleprovider chain to FileWriter.
You never give a full chain : wavein to waveout is not of great help in practice. And you never explained how to connect sampleProvider to waveOut.


Apr 17, 2013 at 9:43 AM
if you want to pipe waveIn to an output, use BufferedWaveProvider.

For your second example, AudioFileReader does exactly what you are asking. Look at the code to see how it does it

To a filewriter - you cold use WaveFileWriter.CreateWaveFile (and CreateWaveFile16 which takes a sampleprovider)

There are several classes in NAudio that go from WaveProvider to SampleProvider and vice versa. Look at Pcm16ToSampleProvider, SampleToWaveProvider, SampleToWaveProvider16. For NAudio 1.7 I am planning to include some extension methods on both IWaveProvider, ISampleProvider and WaveOut which will simplify switching between the two audio stream representations.