0

I'm new to the android platform, and I wanted to develop an app that runs in the background and reads the microphone input, applies a transformation to it, and outputs the resulting audio to the speaker.

I'm wondering if there is any lag perceived by the user in this process, or if it's possible to do it in near-realtime so that the user can hear the transformed audio in sync with the ambient audio. Thanks!

Rohan
  • 383
  • 3
  • 6
  • 14

3 Answers3

2

Yes, users will hear a severe latency lag or echo with attempts at real-time audio on current unmodified Android devices using the provided APIs.

The summary is that Android devices are configured for fairly long audio buffers, which has been reported to be in the somewhere around the range of 100 to 400 milliseconds long, depending on the particular device and the Android OS version it is running. (Shorter buffers might be possible on Android devices on which one can build and install a modified custom build of the OS with your own custom audio drivers.)

(Humans hear echoes at somewhere around or above 25 mS. Audio buffers on iOS can be as short as 5.8 mS, so you may have better luck trying to develop your near-real-time audio processing on a different device platform.)

hotpaw2
  • 70,107
  • 14
  • 90
  • 153
  • Galaxy nexus now has latency as low as 20 ms. http://forum.xda-developers.com/showthread.php?t=1674836 – Motomotes Jun 14 '12 at 21:14
  • there is a delay in the processing, but, is the realtime sampling possible? read this: http://stackoverflow.com/questions/19646057/android-realtime-audio-aquisition-loosing-some-samples – Gaucho Oct 28 '13 at 22:17
1

Audio processing on android isn't all the great, in fact to be honest, it sucks. The out-of-the-box latency on android devices for such things is pretty awful. You can however tinker with the NDK and try to put together something based on OpenSL ES which will have significantly low latency.

There is a similar StackOverflow question: Playing back sound coming from microphone in real-time

Some other helpful links:

Community
  • 1
  • 1
Soham
  • 4,940
  • 3
  • 31
  • 48
0

On the other side of the coin, android mic quality is way better than IOS quality. I have a galaxy s4 and a huawei very low end phone and both have a wonderful mic quality when recording.

Zibri
  • 9,096
  • 3
  • 52
  • 44