capturing and outputing audio in windows vista or 7

Stuck with a problem in your code? Seek help here.

capturing and outputing audio in windows vista or 7

Postby jeozero » October 25th, 2011, 7:49 pm

I would like to write a program which can capture the audio output on one PC, buffer it, transmit across the network to another PC which will output that audio. Basically like Airplay, but I want to output from all programs and stream to another PC instead of an apple basestation.

I think this should be possible with Visual Studio? I've been digging around in the Windows SDK, but couldn't find anything that actually worked on Windows 7. Does anyone have any suggestions on wher to look for some APIs which would allow me to capture the audio?
Posts: 1
Joined: October 25th, 2011, 7:40 pm

Re: capturing and outputing audio in windows vista or 7

Postby MadHatter » October 25th, 2012, 6:33 pm

If you find it, let me know...trying to do something similar, with no luck, so far. I started out approaching it as a hardware deal, though, trying to hook a logitech G930 so two headsets could listen to one computer (no issue with digital encryption, or anything other than forcing both headsets onto the same channel at the same time), but since they dynamically change channels, trying to keep one on the same channel as the other isn't working well....or really, at all.
Posts: 5
Joined: October 25th, 2012, 6:04 pm

Re: capturing and outputing audio in windows vista or 7

Postby GaspingSpark » October 26th, 2012, 2:18 pm

As for commercial solutions Airfoil supposedly can do this: (costs $25, free trial version overlays noise on the signal after 10 minutes, I've never personally used it)

As far as I know there isn't an API to capture loopback audio. (But that doesn't mean its not buried in there somewhere.) Some device drivers have a "Loopback" or "Output" or "Stereo Mix" capture port that lets you capture all audio sent through them. But many devices don't.

To capture all audio you need to write a device driver that acts as a sound card and streams the audio. Or maybe you could do it with a filter driver that sits between the audio streaming and the output. Something like the stuff in the "Enhancements" pane of the audio settings. Either way, you need to look at the Windows DDK. It could take months just to figure out all the weird little APIs needed like the filter graphs and DRM security.
Posts: 180
Joined: March 8th, 2011, 10:24 am

Re: capturing and outputing audio in windows vista or 7

Postby semicolo » October 27th, 2012, 11:55 am

On the hardware side, what about looping the output to the line in(stereo only)? All you need is a 1/8 male/male jack cable (set the output level rather low to start).
Your software then only needs to record and stream, you can probably find existing softwares to do that for you too.
User avatar
Posts: 270
Joined: December 13th, 2011, 3:32 pm

Re: capturing and outputing audio in windows vista or 7

Postby st2000 » October 27th, 2012, 1:14 pm

Windows if a for profit operating system. As such I always find it more difficult to create programs for Windows. You might turn to open source programs that happen to have been ported to windows. To answer the first half of how to get the sound coming out of your speakers back into the computer there are some ideas here:

Appears the only sure way is to use hardware. Which has already been talked about here.

And for broadcasting I was thinking of a live pod cast program. But I haven't found one yet. Might be worth 5 minutes of your time to see if there is one that is open source. That way you will not be starting from scratch.
Posts: 1350
Joined: February 3rd, 2011, 6:10 pm

Re: capturing and outputing audio in windows vista or 7

Postby Quin » October 31st, 2012, 1:26 pm

3 problems, solve them in order.

First, can you write a windows app? If you can program in a language Visual Studio likes, you are set, but otherwise mixing audio buffers and networks is a tough start.

Capturing audio. Look at the SDK example Multimedia\audio\CaptureSharedEventDriven and see how it works. It captures audio and writes it to a file, but it will get you looking at the right header files for audio work. Then you need to work out your buffer; circular array should work best for this. More of the audio API is available ... 02(v=vs.85).aspx and you might look at the audio programing guide ... 99(v=vs.85).aspx and focus on both the endpoint (microphone and speakers at the other end) and the stream management (how you read from the mic or output to speakers).

Network stuff is last, and I'm not the person to ask about that. I don't know what the stream protocols look like, or how to encode to them. An MP3 stream should work, I would suggest google for something like a streaming audio library. That way you have a standard output. Or you might create your own protocol so only your own device and app could listen at the other end; though security says that's a bad idea it might be an interesting project. Piping raw PCM WAV across your network might work, but you'll need a large buffer and have to account for odd latency issues if you have any network problems; while compressing your audio buffer into an MP3 or other format stream will require the above work.
Posts: 106
Joined: February 24th, 2012, 9:17 am

Return to Help Me! Software

Who is online

Users browsing this forum: No registered users and 1 guest