android get device overall audio output in pcm

lelloman picture lelloman · Feb 28, 2013 · Viewed 12.4k times · Source

Is there any way to intercept or just-read the audio output in android device?

I need to read the whole audio output in PCM from inside myActivity, including media player application in background, voice from calls, MediaPlayer istances inside myACtivity, etc., everything that's going to played by speakers. Actually, if it was possible to read them separately, would be great as well.

I tried with AudioRecord, giving it as audioSource parameter every constant found in MediaRecorder.AudioSource with no luck, should I try different audioSources?

Is it a so low-level task that has to be handled within native layer?

Answer

TheLivingForce picture TheLivingForce · May 11, 2015

The visualizer class is helpful. I use it to playback immediately played audio here.

This audio comes in very low quality, however, so it's only really good for visualization.