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

BufferedWaveProvider to Wavestream

May 9, 2013 at 2:51 PM
Hi , I'm working on a project that applies some effects over some microphone input and I would like to be able to get that input to a wavestream. I tried using BufferedWaveProvider to send the input to the wavestream but it doesn't work.

Is there a way to achieve this? Some example would be helpful.

May 9, 2013 at 10:20 PM
why do you need a wavestream? WaveProvider is simply a non-repositionable wavestream.
May 10, 2013 at 1:34 PM
In my project I use wavestream for my effects class and now I need to bring the input from the microphone in that class. I get the microphone input with the waveinprovider but I don't know how to convert from waveinprovider to wavestream.

If i read from a mp3/wav file with Mp3FileReader/WaveFileReader I manage to send the data to my class but from waveinprovider i can't.

Is there a way to get microphone input to a stream (wavestream)?

May 10, 2013 at 4:36 PM
There shouldn't really be a need for your effects to take a WaveStream as the only things a WaveStream has over an IWaveProvider is position get/set and Length get. If you really must turn an IWaveProvider into a WaveStream it is very easy by creating an adapter class. In Position get, return total bytes read so far, throw an exception for Position set, and Length get can return whatever you want it to. All other methods (Read + WaveFormat) can delegate down to the IWaveProvider.
May 10, 2013 at 5:03 PM
Now I am traing, thanks for the solution :D .