문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top