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

Capture stream audio by internet

Jan 13, 2012 at 7:37 AM

can i get continuos stream by internet and tell it by program ( that must record every 20 seconds for minute without stop record stream ?

Jan 13, 2012 at 8:26 AM

I don't see why not. You need to know what compression type you are receiving, but just write 20 seconds worth to a file, and then throw away the next 20 seconds and so on.

Jan 13, 2012 at 8:34 AM

When I capture where record stream go ? Inside memory ? like arraybyte ?

Jan 13, 2012 at 8:37 AM

well NAudio doesn't do any receiving of audio from the internet - you need to write that bit yourself, so it depends on your program. If you are using a NetworkStream, you will get data into a byte array, and need to copy it out.

Jan 26, 2012 at 1:34 AM

Then how would you pass the data if its a continuous stream? Obviously this would have to be in its own thread. It wouldn't necessarily need to do play back. Just need to figure out how to constantly be able to put the stream into the file is the big issue, meanwhile the 2nd issue would be able to figure out when the internet track changed. The stream does provide track name though so figuring that out is also something to be done.

Jan 26, 2012 at 9:17 AM

What you would typically do is put the audio you have received over the network into a BufferedWaveProvider if you want to play it as it arrives, or just use a WaveFileWriter if you want to save it to disk.

Jan 30, 2012 at 5:10 PM

I haven't need to play stream audio, i must only record 20 seconds every 1 minute.
But i must get stream audio from different web sites simultaneausly


Jan 30, 2012 at 5:18 PM

well just discard packets for 40 seconds, and then for 20 seconds write them into a WAV file writer. If you need to mix together multiple streams, then your program is quite a bit more complicated, and you would need to use BufferedWaveProviders as an input to a mixer.

Jan 30, 2012 at 8:18 PM

I must record separately