Problem recording audio from a headset microphone, while music is playing

65 views
Skip to first unread message

Gil Fidel

unread,
May 6, 2015, 10:20:40 AM5/6/15
to android-...@googlegroups.com
Hello,

I'm developing an Android app that needs to record audio while music is playing on the device.
I've stumbled upon an issue where on some devices (but not on others), when I'm using a standard headset (mic+earphones) the recording contains the music being played in addition to the surrounding sound that should be recorded.

  • This happens on different devices and with different Android version.
  • There are devices on which it doesn't happen (with the same headset) - i.e the recording is clean and doesn't contain the played music.
  • I've tried using both the AudioRecord API and the OpenSL ndk API and got the same results.
  • The same happens when recording using the standard Voice Recorder app - thus it is, most likely, a platform issue and not a bug in my app.
  • This happens regardless of the AudioSrc used for recording (DEFAULT, MIC, VOICE_RECOGNITION, VOICE_COMMUNICATION)
  • This does NOT happen when using the built-in mic (i.e. when connecting earphones only).

My first thought was that the issue was caused by electrical leakage inside the headset, but the fact that the recording is clean (doesn't contain the played music) on some devices seems to contradict this assumption.

I understand that recording audio while listening to music is not a *very* common use case, but I would expect it to work flawlessly nevertheless.

Has anyone run into a similar issue?
What do you think causes it and how can it be solved?

Thanks!

Glenn Kasten

unread,
May 6, 2015, 9:07:14 PM5/6/15
to android-...@googlegroups.com, gil....@gmail.com
Thank you for the detailed explanation of the behavior you're seeing.

I'm curious whether you also see this during telephony (standard cell phone call) over wired headset
and/or VoIP (Internet phone call) over wired headset.
That is, do you hear your own voice in addition to the remote end?
My guess is you do will have the problem with standard cell phone call, but would with VoIP, but it would be good to confirm.

Also, have you tried this on any Nexus family devices?
If so, can you please say which Nexus models and OS versions, and what the results were for each.
I ask about Nexus because I can more easily try out on those.

Gil Fidel

unread,
May 7, 2015, 8:11:23 AM5/7/15
to android-...@googlegroups.com, gil....@gmail.com
Hi Glenn, thanks for the quick reply.
  1. Will check about cell-phone/VOIP and will update
  2. I've done testing on a bunch of devices.
  3. This issue occurred on the following devices:
    1. LG Nexus 5 | Android 5.1 (though only tested with the DEFAULT AudioSrc)
    2. Samsung GT-I9301I (Galaxy S3) | Android 4.4.2
    3. Samsung GT-I9100 (Galaxy S2) | Android 4.1.2 (with Custom "Omega" ROM)
    4. Samsung GT-S7580L | Android 4.2.2
    5. HTC Desire 310 | Android 4.2.2
    6. Huawei Y300 | Android 4.1.1
    7. Sony C1504 | Android 4.1.1
    8. AKAI Apollo | Android 4.4.2
  4. These devices were OK:
    1. LG G3 | Android 5.0
    2. Samsung Galaxy S4 | Android 4.2.2
    3. Samsung SM-G130M (Samsung Young 2 ) | Android 4.4.2
  5. I have most of the above mentioned devices available to me so I can assist you with any further testing that might be required or with any questions.
  6. From my side - it's very important to understand what causes the issue and to get an estimate of how widespread it is (i.e. if it only happens on 5% of devices I might be able to live with it, but if it happens on 50% of devices then I'll have to rethink the concept of what I'm working on...).

Thanks a lot!

P.S.
I've recently watched your Google I/O 2013 talk about Android audio latency and both the talk and the improvements you've done were excellent, great job!
Reply all
Reply to author
Forward
0 new messages