This project has moved. For the latest updates, please go here.

Get data from a playing wav file

Apr 26, 2013 at 6:16 PM
Hello,
I need to get data from a playing wav file in order to encode them and send them to a voip server. I managed to do this while recording myself using the dataavailable callback.
void wi_DataAvailable(object sender, WaveInEventArgs e)
Can i do the same with a wav file?
Thank you :)
Apr 27, 2013 at 12:52 AM
I don't think you can do this with WaveIn() unless you are streaming from a device. You may be able to create a virtual device with DirectShow that plays back files, and then uses WaveIn() to intercept the virtual device.

Would it not work with your needs to read the bytes out of the wav file in to a stream and then send those bytes to your server?
Apr 27, 2013 at 12:52 PM
Would it not work with your needs to read the bytes out of the wav file in to a stream and then send those bytes to your server?
Maybe, How can get the bytes from a wav file? I need to convert them to speex 8 or 16khz(or celt) before sending them so does it means i need the WaveFormat to be 8 or 16Khz? How can i do this?

Thank you :)
Coordinator
Apr 27, 2013 at 4:54 PM
please read this article for a detailed explanation of how to convert between audio formats with NAudio.
Apr 29, 2013 at 6:28 PM
Edited Apr 29, 2013 at 7:21 PM
Would it not work with your needs to read the bytes out of the wav file in to a stream and then send those bytes to your server?
Ok it work thank you
please read this article for a detailed explanation of how to convert between audio formats with NAudio.
I managed to convert it with the WaveFormatConversionStream Method