Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get access to the speaker signal on Android?

Sending audio to the speaker for playback on Android is easy, but is it possible to get a copy of the actual final digital signal? Let's say I have 2 apps running "MyApp" and "SomeOtherApp". My app sends audio to the speaker, but so does "SomeOtherApp". "SomeOtherApp" is not my app - it's a 3rd party app. Is it possible to get a copy of the mixed audio signal which is played to the speaker by the OS? That is, the audio signal which is a mixture of the speaker signal from my app and the speaker signal from "SomeOtherApp".

To summarize: I am looking for a way to hook into the low-level audio path (HAL audio stream out - after mixing!) so I can get a copy of the "final" speaker signal (in real-time). Optimally, I would also like to hook into the low-level microphone path, but that's less of a concern right now.

like image 505
user1884325 Avatar asked Jul 15 '16 18:07

user1884325


2 Answers

Looks like the short answer is no.

Longer one is kinda. And sorta. But not really, as far as I know. Option 1: it might be a problem with respects to privacy. (not really a good option) Option 2: nobody thought it was needed, so did not build it into the system. Option 3: the amount of trouble shooting when programmers use the wrong source is just not worth it.

edit - You can, of course, record the input.

like image 199
Flummox - don't be evil SE Avatar answered Oct 10 '22 21:10

Flummox - don't be evil SE


Checkthis one google example

Usage :

App will capture audio from android devices and playback on the same device; the playback on speaker will be captured immediately

*

like image 1
O_Z Avatar answered Oct 10 '22 21:10

O_Z