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

3

5

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.

Urissa answered 18/9, 2013 at 15:20 Comment(5)
Try the library FMOD which is already ported to android. If you provide the two sample files. I might try them using FMOD as I already have a working project.Thirteenth
Sherif, thanks for your input, I will have a look at the library and whether it will circumvent the audio processing.Urissa
Do you have hard evidence that the AGC is on the output? I'd be much more likely to suspect such to be used on the input side. Perhaps you can test against some other sources / recorders? Also, you should expect the API to have a substantial delay that will randomly vary each time you start a session.Canaletto
Hi Chris, you are right in that the API introduces a somewhat random delay each time I have a playback and recording started. This is not a big problem though as I sync the data afterwards based on cross-correlation. The DRC/AGC/Limiter/Leveller or whatever you might call it actually affects the output: I had a reference mic installed in front of the speaker, and there the problems arise. As for the device's mic, I chose VOICE_RECOGNITION as the AudioSource, which provides unmodified input.Urissa
Thanks all for you contributions to my problem. I will award the bounty to Mike, since your answer actually led me on a new track. I cannot tell yet which answer will lead to a working solution. Once I come up with one, I will accept the appropriate answer.Urissa
S
4

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);
    }
}
Strontium answered 8/10, 2013 at 19:38 Comment(1)
Hi Josh, thanks for the hint. I have indeed not tried this explicitly. However, the AGC class is introduced in API level 16, and my Wildfire S is running Android 2.3.5 (API level 10). I am using the same API level on both phones. Still, I will try whether this has an effect on the One X with its appropriate API level.Urissa
A
3

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?

Ardis answered 6/10, 2013 at 0:3 Comment(3)
Hey Mike, Thanks for your answer so far. I found this site: androidpolice.com/2012/06/26/… with similar information. The beats EQ can be ruled out, since I had another app taking control of it, and I set it to neutral. Otherwise, the attenuation effect is present on both devices.Urissa
Interesting, thanks for the update. I'll pick this back up later today.Ardis
Let me clarify that the issue is not sound quality but something like gain- or dynamic range control.Urissa
G
2

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.

Glow answered 7/10, 2013 at 15:7 Comment(2)
Thanks for the input. The strange thing is that the same happens on the Wildfire S, which has no Beats Audio at all.Urissa
I will still try this out on the One X.Urissa

© 2022 - 2024 — McMap. All rights reserved.