Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I'm trying to figure out a way to capture the system audio of an Android and/or Windows Phone. The idea is to provide a stream based on the music I'm currently playing on my phone.

What I'm not sure about is what the best approach would be for sending the audio. Preferably I'd like to capture all the device audio (same as when connected to a bluetooth device). But I'm not sure whether this is possible with Android or Windows Phone.

For Android I found this article http://xzpeter.org/?p=254, he states this is'nt possible without making your own Android build. Which isn't an option for me.

For Windows Phone I can only find ways to capture audio from the mic. Not directly from the system.

The only alternative I can come up with is to let the app provide all the audio, meaning I would have to build all the basic mediaplayer functionality into the app. But this would mean I have to put much more work into the app, and I wouldn't be able to use other apps like Winamp and YouTube to provide audio.

Did I maybe overlook a way to capture all the audio of the device? Or maybe there's a way to capture audio from specific applications?

Edit

After doing some more research, I really doubt I can capture all system audio. Or maybe it's possible to simulate an bluetooth audio device?

For the Windows Phone I was going for the alternative solution: selecting songs which would then be streamed to the server. But it seems that for Windows Phone it's not even possible to get physical access to the songs: http://stackoverflow.com/questions/16251400/stream-a-xna-framework-media-song-to-a-server

share|improve this question

1 Answer 1

Here is a potential partial solution, though not really a programming solution.

Assuming the goal is specifically to have the audio of a music file from your mobile device play on another device, for example, a PC or server, you might try the OnAir player, which has apps for mobile devices, some televisions, and Mac/Linux/Windows computers.

If you have further processing to do with the audio, you an probably set up your computer to capture the audio and redirect it.

You don't state your final goal for the audio or what kind of server you are using for streaming, but here's a theoretical example setup:

I could run the app on my Android phone, streaming to my Linux PC. Pulse Audio (default on Ubuntu Linux) allows output capture, so I could write a program to receive the audio and redirect it to the input of a streaming program.

This would only cover the music you are playing from OnAir of course; none of the other sounds would come through (such as SMS and email notifications or the phone ringing).

Also note (as my second link points out): be careful with copyright restrictions on the audio. If you don't own the content and are streaming to other people you can get into trouble.

References:

onAir: http://www.onairplayer.com/onair.html

Capturing audio in Linux: http://manual.audacityteam.org/o/man/tutorial_recording_computer_playback_on_linux.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.