Question

I was hoping to create one of those apps that shows goofy colors on the screen that is dependent on what is coming from the speaker, in particular the intensity of the sound, and in real time as is possible.

I figure there are two possible scenarios that will get me where I want:

1) I can play my own music/sound file and monitor the stream from my own invoked MediaPlayer or

2) I can just monitor the intire stream that is connected to the speaker, then invoking my own MediaPlayer and sound.start().

Are either or both of these possible?

I have looked up both potential ways and have come up nill, in particular AudioTrack and after some headscratching it seems it is only possible to use the microphone input, which is not what I am looking for. Any Suggestions?

Was it helpful?

Solution

I haven't used it myself, but Visualizer looks like it's intended for this purpose. You can target a particular AudioTrack or MediaPlayer, or the entire output mix.

This post suggests an alternate tactic, using an undocumented method MediaPlayer.snoop() (release 6 at least). I don't quite follow it though. I would see if you can get Visualizer to work.

This post also links to some examples.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top