[MOD][ROOT] Camcorder Audio Quality "Fix" and Thoughts on In-Call Voice Quality
I was asked to open a new thread with a workaround that deals with poor audio quality when using the Nexus 5 Camcorder, which I originally posted in this thread: http://forum.xda-developers.com/goog...rible-t2776502
So here it goes...
I have spent a lot of time trying to fix the in-call recording distortion issue (incoming audio) that seems to plague many devices with
Qualcomm chipsets that are trying to use call recording software that records from the line, like the excellent CallRecorder by @skvalex
(Actually I found a way, which may not fit the broad population, but it works for me. PM me if you are interested). My time spent on this
endeavor gave me quite some insight into the audio subsystem
Up until now I have not really used the camcorder feature, but recently I have and lo and behold, the quality is god-awful.
So I played around with one of the system libraries, i.e. /system/lib/hw/audio.primary.msm8974.so and the audio mixer settings file, i.e.
The problem seems to be that the audio path chosen within the Qualcomm chipset by the camcorder is enabling a noise suppression algorithm
that is way too aggressive. The way I found around this problem is to find (by trial and error) a signal path that seems to bypass noise
suppression when the camcorder is used.
Give the attached library and settings file a try (either by modifying your system manually or by using the Aroma installer provided
, see third post) and report back whether it works for you.
If you go the manual route, unpack the archive, make a backup of the existing
library and settings file, copy the new ones in their respective place, and reboot. Make sure to not rename (or misspell)
the files before the reboot, otherwise you will get into a boot loop.
Also, make sure you give the files the correct permissions (644, i.e. rw-r--r--) after they have been copied to your phone.
In short, don't try this if you don't know what you are doing...
Of course, root is required to write to the system partition.
The attached library was built from 4.4.4 AOSP
(branch: android-4.4.4_r1, build: KTU84P). It may or may not work with an older
version of stock KitKat.
It will probably not work with any other version of Android, but
I'd be happy to share the mod so it can be built for other ROMs, if the modified library seems to work for people (it does for me).
For sure, this mod does not currently work with CM.
NOTE: People may have played with their mixer_paths.xml file to modify other audio-related issued. In that case you need to merge
your original mixer_paths.xml with the attached modified one.
REMEMBER: Always make a backup of your original system files first!
Changing the microphone gain
The microphone path used by this mod is "voice-rec-mic-mod", which is derived from "voice-rec-mic" already present in the stock version of
The default microphone gain is set to 88 ("DEC6 Volume"). If one feels that microphone "sensitivity" is insufficient, this gain can be
increased significantly. According to ALSA mixer data, the maximum level can be set 124 (not sure about the actual gain difference in dB,
but it is very audible). Of course, there is a tradeoff between microphone gain and background noise, i.e. higher gain results in more audible
microphone/preamp ("white") self-noise. As a matter of fact it is this noise that the original library tries to fight with its poorly
implemented/configured noise suppression algorithm.
Static modification of microphone gain:
- method 1: The gain can easily be changed by editing line 360 ("DEC6 Volume") of the new mixer_paths.xml file directly via a file browser,
like Root Explorer. The values can range from 0 to 124. I have not tested yet whether the phone has to be rebooted after modifying the file,
but it may be good practice to do so
- method 2: run the Aroma installer from the third post
Dynamic modification of microphone gain using tinymix (use is currently limited):
Once the recording has started, the microphone gain can quite easily be modified with the help of the attached tinymix binary,
which can be built from the AOSP tree.
The syntax (after it has been uncompressed), copied to, e.g., /system/bin, and made executable is:
> tinymix "DEC6 Volume" X
where X=[0,124]. Again, there will be a tradeoff between microphone gain and noise amplification.
The big caveat is that the gain is reset to the one listed in the file /system/etc/mixer_paths.xml every time a new recording is started.
Shy of having the phone tethered to a PC during a shoot where the gain change can be initiated through adb, there may be a way for a dev
to come up with a "floating" gain setting (go here http://forum.xda-developers.com/show...4&postcount=84
if you would like to try a Tasker "scene" I cooked up for this), via a permanent notification, or bake it into a custom camcorder app.
Update: Actually, I think the problem of resetting gains can be solved with Tasker. One can imagine a profile that kicks in once the camera app is launched. That profile kicks off a shell script which continuously monitors the status of the sound card in /proc/asound/card0/pcm0c and reports status changes (i.e. triggered by starting/stopping a recording) back to Tasker. Tasker, in turn, can make the necessary changes. Convoluted, but it should work...
Kudos go to @spacetaxi
for providing the Aroma installer (third post).
Please direct all questions to him for questions around the installer and its use.
I'm more a "just the facts ma'am" kind of guy...
Added a patch file so devs can integrate the fix into their custom ROMs, if desired
Although this mod was originally developed for stock Android 4.4.4 (KTU84P), I have seen reports of it working (as is) on
recent versions of MIUI, OmniRom, PAC ROM, CarbonROM, PA ROM, SlimKat, and OctOS. In fact, this mod has a good
chance of working on all recent ROMs that closely follow AOSP as it really only changes a C library which sits underneath the Android stack.
A version for CM11
can be found here:
Go here for @spacetaxi
's Aroma installer of the fix for CM11:
Update (08/08/2014) #2:
I added some thoughts on poor in-call voice quality here:
A version for L-Preview
can be found here:
Go here for @spacetaxi
's Aroma installer of the fix for Android L developer preview (build LPV81C):
Some results and discussions with regard to gain settings can be found here:
Sound samples comparing the camcorder using the stock audio library vs my mod can be found here:
The setup was well-controlled while the recordings were being made, thereby allowing for a bias-less comparison.