Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable audio output processing on an htc phone with Android

I am trying to measure the audio path from speaker to microphone on two different phones, an htc Wildfire S running Android 2.3.5, and an htc One X running Android 4.0.3. Using Eclipse, I coded an app that has wave files played back using an android.media.MediaPlayer. However, my recordings show that something like an automatic gain control is applied to the output, as loud files are attenuated, and the recordings feature almost equal amplitudes, although the played back files vary widely in their respective amplitudes.

How can I switch any processing of the audio data off prior to output? I would like to obtain direct control over raw audio output.

Thanks in advance.

like image 678
Ingo Schalk-Schupp Avatar asked Sep 18 '13 15:09

Ingo Schalk-Schupp


3 Answers

Have you tried disabling the built-in AGC and AEC audio effects? More info at http://developer.android.com/reference/android/media/audiofx/AutomaticGainControl.html

For example:

int audioSession = ...;
if(AutomaticGainControl.isAvailable())
{
    AcousticEchoCanceler agcfx = AcousticEchoCanceler.create(audioSession);
    if(agcfx != null)
    {
        agcfx.setEnabled(false);
    }
}
like image 200
Josh Avatar answered Nov 09 '22 07:11

Josh


I'm guessing from your mention of the Wildfire S you're outside of the USA, so let me speculate on something here...

Are you experiencing identical attenuation and other equalization-type effects on both devices, or just one compared to the other? If you're fine on the Wildfire but experiencing issues on the One X, and you're using the international release of the One X, the issue could be the SoC audio included on that handset.

The USA release of the One X/S/XL uses the WCD9310 DAC by Qualcomm. The international release with the Tegra 3 chipset with a Realtek DAC on board, and it's notoriously piss-poor sounding.

Also, are you sure the proprietary Beats Audio equalizers on the One X are disabled and in no way contributing to your attenuation?

like image 40
Mike P. Avatar answered Nov 09 '22 09:11

Mike P.


Make sure you turn off Beats Audio.

I was working on a project that required unmodified audio stream, but the Beats Audio on HTC phones was interfering with it. You have to dig through the settings to make sure its completely off, I believe there are two similar settings controlling it. You can't programmatically disable it in your code, it has to be done on the phone.

like image 36
Dan Osipov Avatar answered Nov 09 '22 07:11

Dan Osipov