Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid > 4.0 : Ideas how to record/capture internal audio (e.g. STREAM_MUSIC)?
    text
    copied!<p>Some months ago, with Android ICS (4.0), I developed an android kernel module which intercepted the "pcmC0D0p"-module to fetch all system audio.</p> <p>My target is to stream ALL audio (or at least the played music) to a remote speaker via AirPlay.</p> <p>The kernel module worked, but there where several problems (kernel-versions, root-privileges etc.) so I stopped working on this.</p> <p>Now, we have Android 4.1 and 4.2 and I have new hope!</p> <p>Who has an idea how to capture the audio in Android?</p> <p>I had following ideas:</p> <ol> <li><p><a href="https://stackoverflow.com/questions/13875126/android-possible-to-connect-bluetooth-to-self/13879176#13879176">Connect via bluetooth</a> to the same phone, set routing to BT and grab the audio on the "other end": this shouldn't work</p></li> <li><p>Intercept the audio with a kernel module like done before: hardcore, get it worked but not applicable</p></li> <li><p><a href="http://jackaudio.org/" rel="nofollow noreferrer">JACK Audio Connection Kit</a>: sadly Android uses "tinyALSA" and not "ALSA". TinyALSA does NOT support any filters like JACK (but this brought the idea with the kernel module)</p></li> <li><p>Use PulseAudio as a replacement for AudioFlinger, but this is also not applicable</p></li> </ol> <hr> <p>EDIT (forgot them):</p> <ol start="5"> <li><p>I compiled "tinymix" (baby-version of ALSA-mixer) from <a href="https://github.com/tinyalsa/tinyalsa" rel="nofollow noreferrer">tinyALSA</a> (the ALSA on Android) and tried to route the audio-out to mic-in - but with no success (<a href="https://stackoverflow.com/questions/10733214/android-how-to-configure-tinymix-to-record-system-audio-with-tinycap">not understandable for me</a>). And this also needs rooting: not applicable</p></li> <li><p>I tested <a href="http://www.khronos.org/opensles/" rel="nofollow noreferrer">OpenSL ES</a>, but I'm not a C-crack and it ended in "I can record microphone, but no more" (maybe I was wrong?)</p></li> </ol> <hr> <p>I just found <a href="http://developer.android.com/reference/android/media/MediaRouter.html#ROUTE_TYPE_LIVE_AUDIO" rel="nofollow noreferrer">ROUTE_TYPE_LIVE_AUDIO</a>:</p> <blockquote> <p>A device that supports live audio routing will allow the media audio stream to be routed to supported destinations. This can include internal speakers or audio jacks on the device itself, A2DP devices, and more.</p> <p>Once initiated this routing is transparent to the application. All audio played on the media stream will be routed to the selected destination.</p> </blockquote> <p>Maybe this helps in any way?</p> <p>I'm running out of ideas but want to "crack this nut", maybe someone can help me?</p> <p>EDIT:</p> <p>I'm really new in C &amp; kernel-coding (but I successfully created a cross-compiled audio-interception-module) - but isn't it in any way possible to listen at the point the PCM-data goes from userspace (JAVA, C-layer?) to the kernel-space (tinyALSA, kernel-module), without hacking &amp; rooting?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload