Audio routing

311 views
Skip to first unread message

Amritendu Biswas

unread,
Aug 23, 2011, 2:40:26 AM8/23/11
to andro...@googlegroups.com
Hi,
I am trying to create one application/service which will record incoming voice call and auto answer with pre-recorded media. That means instead of playing incoming voice data to speaker/headset it will be recorded as a media file and rather than taking voice input from mic/headset, it will be taken from media file.
I searched in various forum and some people say it can be possible with ALSA routing. But I don't see much clarity on this. I am ok in modifying source code and use as custom ROM.
Please let me know whether this can be achieved or not. If yes please point me the area (code path, framework) I need to look in.
Thanks,
Amritendu

mic _

unread,
Aug 23, 2011, 8:40:27 AM8/23/11
to andro...@googlegroups.com
This will not be the least bit portable.
For example, the fairly widespread MSM8255 platform doesn't support recording of the voicecall RX path IIRC. The older 7227 supported it, but only in the form of tunneled AMR recording.

I'm not aware of any platforms that support injecting data into the TX path, though they might exist. You might be able to do some platform-specific hack that replaces one or more component in the voice call graph with your own customized versions. You're going to be down at the platform level though, so you'll probably need the source code from the platform vendor (which may not be available to you).

/Michael

--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.

Amritendu Biswas

unread,
Aug 23, 2011, 9:36:22 AM8/23/11
to andro...@googlegroups.com
Hi Michael,

Thanks for your reply.

I am not specifically thinking of getting/injecting voice data through
base band Rx/Tx. Because voice call can be initiated through data
connection (e.g. skype) also. I am looking in the area where voice
data from MIC (hardware for voice input) is converted into PCM data
and sent to the requesting application/service. I want to create an
application which can supply PCM audio data to the requesting
application (irrespective whether Tx base band or Skype is waiting for
voice data from MIC). Similarly same thing in case of speaker, my
application should capture PCM audio data when some voice data is sent
to the speaker.

I think it can be possible by source code modification of kernel /
driver / platform of android audio stack. I am new to this area so
need some pointer to start with.

In case only base band Tx/Rx voice call (not considering skype call)
if it is possible then also I am interested (assume I will get source
code from platform vendor).

Thanks,
Amritendu

mic _

unread,
Aug 23, 2011, 10:19:37 AM8/23/11
to andro...@googlegroups.com
In the VoIP case there are probably a few different places where you could make your changes, e.g. the AudioFlinger, or the AudioHardware input/output stream read/write methods, or AudioTrack/AudioRecord.

/Michael

Amritendu Biswas

unread,
Aug 25, 2011, 6:21:02 AM8/25/11
to andro...@googlegroups.com
Hi Michael,

I am looking into audio source you mentioned. I have one question, is
circuit switched voice call uses different path other than
AudioFlinger, AudioTrack/AudioRecord, AudioHardware etc?

Also CallRecorder application records directly from the phone line
with custom rom. So accessing voice data from phone line should be
possible.
https://market.android.com/details?id=com.skvalex.callrecorder

Thanks,
Amritendu

mic _

unread,
Aug 26, 2011, 9:21:25 AM8/26/11
to andro...@googlegroups.com
Yes, CS calls are typically handled differently from recording/playback. The actual stream data isn't visible to the audioflinger or to audiohardware.

If the target device is among those listed as supported by the patches linked to from the CallRecorder page, and you're happy with building your own ROM, then recording voice calls should be trivial (set up a mediarecorder that takes the data from AudioSource.VOICE_CALL with an 8 kHz samplerate, or 16 kHz for wideband calls).

/Michael
Reply all
Reply to author
Forward
0 new messages