[ACCEPTED]-Stream audio to a phone call Android-phone-call
Writing to the phone call stream IS possible, but 30 not from the app level on a stock (non rooted) phone.
When 29 a phone call is initiated the mic is "typically" (really 28 depends on the specific phone) routed directly 27 to the baseband, ie skipping the main processor 26 altogether.
For outgoing audio: mic->codec->baseband 25 For incoming audio: baseband->codec->speaker 24
If it were always routed: mic->codec->mainprocessor->codec->baseband
Then 23 the stream would be "presumably" available 22 if the Android APIs (frameworks) supported 21 accessing it.
The reason I say it is possible 20 is because the audio (for nearly all smartphones 19 now) is connected via SlimBus This allows dynamic 18 changing of audio paths. It is however done 17 in the kernel via the codec driver living 16 in ALSA.
So.... were you so motivated, you could 15 get the source for the Linux kernel for 14 a phone and modify the codec/ALSA driver 13 to allow you to change what happens when 12 the call audio path is setup.
Of course 11 then you would incur latency with the new 10 path, breaking the call/latency standards 9 AT&T setup (that Audience helped them 8 write...) and the baseband chip might reject 7 your audio as it's not timely.
Lastly you 6 would need to modify the Android source 5 (frameworks) to grow the API to support 4 injecting audio onto that stream. (You'd 3 need to make big mods to mediaserver, audioflinger 2 in particular...)
It's complicated, but there 1 is your answer. Cheers, :-)
I know the apps that are already sending
all system 7 audio to phone's
earpiece even the songs you plays 6 in your media player without root or any 5 other special permission.
After some research 4 I found that it can be done using
Audio Manager class. For 3 example
AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION); audioManager.setSpeakerphoneOn(false);
Why not to set default output speakers 2 as device earpiece and then play audio using 1
This must be possible because phones will 12 allow Bluetooth to send audio as a microphone.
Since 11 I need to solve this problem one idea I 10 have is to essentially send a bluetooth 9 signal to myself "cloaked" as a microphone 8 input.
Another idea (apologies if it sucks) is 7 to reverse the speaker as a microphone. Since 6 it seems the speaker has access to the hardware 5 required, there may be a way to inject the 4 audio data stream that way.
Since I'm entirely 3 new to coding on Androids with the SDK please 2 excuse the initial botchery of this post, I'll 1 update as I/we figure this out.
Capturing the remote submix audio requires 4 the CAPTURE_AUDIO_OUTPUT permission. This 3 permission is reserved for use by system 2 components and is not available to third-party 1 applications:(
To get the audio data is very possible, but 2 to write audio to upstreaming channel, that's 1 not possible
More Related questions