yashsingh1/xdaforums huggingface dataset:
[Nexus 5 Android Development] chdloc:
Here are some troubleshooting steps:

did you install the latest version of the mod from here?

which option did you choose to install the mod?

did you follow all installation instructions?

please post a logcat while a video is being recorded

does the UI show numbers that seem to vary?

you need to make sure that you have hotword detection from any screen disabled

copy & paste the following command into a root shell (adb) and post the output

find /sys/devices/leds-* | grep green | tail -n 1 | sed 's/\/leds\/.*//' | sed 's/\/sys\/devices\/\.*//'
[Nexus 5 Android Development] SummerBoyz:
Thanks, that was fast. ;)
[Nexus 5 Android Development] GorfDroid:
Got it.

Thanks for that and this mod.

Works wonderfully!

?
[Nexus 5 Android Development] gpvecchi:
Did someone managed to make this mod work with Dirty Unicorns ROM?
[Nexus 5 Android Development] chdloc:
It is my understanding that Dirty Unicorn is currently still based on Andoid KitKat (Omni flavor).

By only spending a few minutes on looking at this, it is not quite clear to me whether the audio HAL is

based on CM, AOSP, or CodeAurora. Your only hope is that either the CM11 fix I posted here or the one based on AOSP KitKat (attached to this post) works for you.

The fact that Omni ROM's mixer_paths.xml file is identical to the stock Android KitKat one makes me believe that your best bet is the fix attached to this post.

Keep in mind that you will be limited to the "simple" mod without noise suppression and without support for aMGC.

Furthermore, these older fixes have very limited low-frequency performance in that loud signals will easily produce catastrophic clipping, unless the microphone gain has been lowered significantly.
[Nexus 5 Android Development] gpvecchi:
Many thanks for your interest! Actually Dirty Unicorns is Lollipop based (here's the thread http://xdaforums.com/google-nexus-5...-dirty-unicorns-5-0-2-hammerhead-1-t3005810); so I assume I can try the CM12 fix. Just one thing, just to know if I'm doing it fine: do I have to push all the files from your mod then the fix files for CM, right?
[Nexus 5 Android Development] chdloc:
In that case, the latest "simple" (no noise suppression) mod may work for you. Have you tried that?

Please post your current mixer_paths.xml file to get a clue as to what this particular ROM is based on (CM vs. AOSP).

Edit: Just saw that the Lollipop version of this ROM is based on AOSP with CAF patches.

CAF has modified the audio HAL quite a bit, so if this ROM uses the new CAF audio HAL you are out of luck, unfortunately.
[Nexus 5 Android Development] AvivEliyahu:
Which is the latest updated cam recorder fix for kitkat 4.4.4?
[Nexus 5 Android Development] GorfDroid:
Code is not showing up for me.

Very interested in fixing this annoying problem!
[Nexus 5 Android Development] chdloc:
Try now. Everything within the "Code" tags seemed to have disappeared

after I've edited my post with the XDA Premium app. Odd...
[Nexus 5 Android Development] chdloc:
See attached. Note that I have dropped support for KitKat as I'm not running it anymore.

This version does support neither stereo recording/playback nor aMGC.
[Nexus 5 Android Development] AtField:
Sorry for the delay in the answer.

I Installed the advanced 6db mod, but i think the problem was that i had hotword detection from any screen enabled. I reinstalled the mod, disabled the hotword detection from any screen and now it works!thanks for the help :)
[Nexus 5 Android Development] GorfDroid:
Wow this worked perfectly!

Thank you so much for this.

It was a serious problem.
[Nexus 5 Android Development] rayiskon:
for some reason i had the same issue with aroma installer. my build.prop is unmodified/stock. I had to push the files manually.
[Nexus 5 Android Development] spacetaxi:
Okay then, I've made an new build of the installer. It should fix that issue. See updated post #3.
[Nexus 5 Android Development] antipasto:
I played with this some more. I wish this also fixed the sound recorder app :p but anyway it seems to crash the recorder about every fourth or fifth recording, and about every third recording it can't save. When it does work, sounds amazing. This is PAC (caf) elementalx kernel in a multi boot. Once I was rather quick at shifting over to the gallery and it foobared the camera app and I had to reboot to get it working again. Stay awesome and thanks for working on this all!!
[Nexus 5 Android Development] chdloc:
What sound recorder app are you using and what needs to be fixed?

Not sure how my mod could cause what you are describing. Please try to reproduce the errors and capture the relevant logcat and kernel messages.
[Nexus 5 Android Development] usaff22:
Sorry for the late reply, but the camcorder with Google Camera fails to record on the L Preview. I checked the md5 files of the stock files in the zip against the stock L Preview ones, and they mismatch.

Sent from my Nexus 5 running Android L Preview
[Nexus 5 Android Development] antipasto:
I guess I was thinking of "Sound Recorder" it is a default system application in most ROMs? Anyway, it is interesting to compare the pristine audio from the camcorder vs the AGC/NR mess that app makes, which I guess is the old way.

Of course now I can't get the camcorder to crash but when I do again I will post the logcat.
[Nexus 5 Android Development] chdloc:
L-Preview mod

When you say that the Google Camera fails to record does it mean that you get video but no audio? Also, do you get any other sounds with the modified library in place? (A mismatched library would most likely cause crashes or even a boot loop.)

If your answers to both questions are "yes", I suspect that your mixer_paths.xml does not contain the following

<path name="voice-rec-mic-mod">

<path name="handset-mic" />

<ctl name="ADC1 Volume" value="15" />

<ctl name="DEC6 Volume" value="88"/>

</path>

If that was the problem, then we know that my original mod works with L. If not, give the attached library a try. I built it from the L-preview source tree, where the relevant source files have not changed from 4.4.4.

Please report back...
[Nexus 5 Android Development] chdloc:
"Sound Recorder" does not seem to come bundled with stock Kitkat. I downloaded it from the market and I would highly suggest to stay away from that program if you are interested in a high-quality recording. The resulting audio from that app is AMR-encoded, which corresponds to cellular quality.

Look for an app that records audio in linear PCM at 44.1 or 48 kHz sampling rate (look for the WAV keyword).
[Nexus 5 Android Development] usaff22:
When I said Google Camera failed to record, sorry I should have been more specific. Turning on video mode works fine, but pressing on the record button does nothing. It just doesn't record, which is why I found it interesting. I then restored a backup, and video recorded fine again.

I'll try the next zip and update it with any findings.

Sent from my Nexus 5 running Android L Preview
[Nexus 5 Android Development] chdloc:
I can reproduce what you are describing by removing the required changes in mixer_paths.xml while keeping the modified library.

So please make sure you add the required changes to mixer_paths.xml (as described above) if you run the modified library.

(Note that the relevant changes in the mixer_paths.xml do no harm even if the stock library is run.)
[Nexus 5 Android Development] Royal King:
Worked for me now! Great recording :)
[Nexus 5 Android Development] usaff22:
Used your L Preview files and renamed / copied them over manually in TWRP, and set permissions. Works great, really happy with the result. Thanks, really appreciate it.

The previous time I used an AROMA zip in the third post, which caused the issue you were describing.
[Nexus 5 Android Development] Origin8:
Wow worked like a charm! The horrible underwater sound while recording is finally gone! I love my Nexus 5 but was close to trading it in for a S5 due to the bad recording but I'm glad I stuck with it. Thanks again for your hard work!
[Nexus 5 Android Development] Peteret:
Can confirm the CM11 version works just fine.
[Nexus 5 Android Development] bruute:
Can someone please make a flashable .zip for CM11 users?
[Nexus 5 Android Development] spacetaxi:
Aroma installer package of chdloc's fix for CM11

This is the aroma installer package of chdloc's fix (fix #1, "simple" fix) for CM11. A newer version for CM11 is not planned. For 4.4.4 stock / AOSP-based roms see post #3. For Android 5.0 see post #235. For Android 5.1 see post #627.

If you flash the attached zip, you'll get two options:

Install Audio Fix: Install chdloc's Camcorder Audio Fix

Install Stock CM11-M9 Audio: Install stock audio lib and config from CM11-M9

So if you are using CM11-M9, option 2 will revert both system files changed by option 1 (audio lib and config) to their original version.

If you are using a different firmware build or if you've changed the config file (mixer_paths.xml) and want to be able to revert the files to their current state, please make a backup of the system partition by using the recovery (CWM / TWRP) prior to installing this zip. Then you can just restore the system partition if you don't like the changes.

By the way, you should make a backup of the system partition in any case! There's always a (small) risk that something goes wrong when flashing a zip. Anything you do, you are doing at your own risk. :fingers-crossed:

Happy flashing! :)
[Nexus 5 Android Development] spacetaxi:
Aroma installer package of chdloc's fix for Android L Preview 81C

2014-11-19 Edit: I removed the aroma installer package of chdloc's fix for Android L Preview 81C, as the version for Android 5.0 is available now. Please see post #235.
[Nexus 5 Android Development] chdloc:
Some measurements and thoughts regarding gain settings

I made a few measurements to determine the relationship between the levels of the

original microphone path and the one chosen by this mod.

Again, the gains are set by the following block in mixer_paths.xml:

<path name="voice-rec-mic-mod">

<path name="handset-mic" />

<ctl name="ADC1 Volume" value="15" />

<ctl name="DEC6 Volume" value="88"/>

</path>

Actually, both "ADC1 Volume" and "DEC6 Volume" can be chosen to adjust the gain.

According to ALSA (alsa_amixer) the limits for these gains are

ADC1=[0,1, 2, ..., 19]

DEC6=[0,1, 2, ..., 124]

However, these levels can seemingly be increased even further with "tinymix" (linked in OP)

to 31 and 211, respectively. The results sound pretty distorted, though, so be careful selecting anything

above the levels suggested by ALSA.

In my measurements I found that "ADC1 Volume" adjusts by about 1.5dB with each gain step and "DEC6 Volume"

by 1dB. Further, the level difference between the signal recorded with the original signal path and the modified one

is about 15dB. I simulated a person holding the phone as the signal to be captured by placing a good-quality loudspeaker

at about 30 cm distance from the phone.

Note that the level difference between the two microphone paths will likely get smaller with distance as the aggressive noise

suppression algorithm does its damage.

The abbreviation "ADC" (Analog-to-Digital Converter) suggests an analog gain which would result in a better SNR (signal-to-noise ratio)

if that gain is adjusted rather the one associated with DEC (which for sure is a digital gain and thus has no effect on SNR if used inside the

signal's full digital scale).

My tests, however, have shown no advantage of using the "ADC1 Volume" setting in terms of SNR which indicates that the microphone

used in the Nexus 5 is a digital microphone with a non-adjustable analog gain stage.

Long story short, you may not want to increase the gain of the mod by more than 15dB by either increasing "ADC1 Volume"

and "DEC6 Volume" or "DEC6 Volume" only. Keep in mind that you will not only increase the signal you want to record by

that amount but also the background noise and, worse, the acoustic front end's self noise. It is the latter part that Qualcomm

and/or LG wanted to control by using (overly aggressive) noise suppression.
[Nexus 5 Android Development] spacetaxi:
Thanks chdloc, I was thinking of doing these kind of measurements, too. ;)

So in theory we should be on the safe side (in regard to overdriving) when setting the DEC6 value to 100, right?

BTW, what's your preferred DEC6 value?
[Nexus 5 Android Development] chdloc:
Well, there is always a chance of saturating the microphone almost regardless how the gains are set.

You only have to get close enough to the microphone and/or shout loud enough...;)

To be honest, I don't use the camcorder all that often. Just to shoot an occasional video of my kids.

Right now I have set "ADC1 Volume" to 15 and "DEC6 Volume" to 103. The result should be a gain

that should closely match the stock setting. I took a few test shots last night at my house while everybody was asleep

and I can certainly hear quite some white noise at that gain setting. It may be good for outdoor shoots and/or

when the kids are going nuts. I'll experiment over the next few days and weeks and report back.

It might be helpful to the community if others share their experiences with gain vs. noise, too...
[Nexus 5 Android Development] krneki10:
[MENTION=2760454]chdloc[/MENTION]

My camcorderMGC app won't open although I granted root permissions :(

Here's what I did:

- flashed Nexus5_5.0.1_LRX22C_v2_audiofix_stereomod_aroma_build2.zip (95 dB, 6 dB, aMGC libraries, mono)

- unpacked shell_scripts.tar.gz into /data/local/tmp/camera (I only executed them but couldn't change permissions with root explorer, I get message "permissions change was not successful. Please note that some file systems e.g. sd card do not allow permission changes.)

- set 777 permisions to tinymix in system/bin with root explorer (but I didn't replace it, aroma installer already does that, right?)

- unpacked CamcorderMGC.prj.xml into /data/local/tmp/camera

- enabled CamcorderMGC in Settings->Accessibility

- installed busybox free and updated it

- installed Tasker and Tasker Factory App (didn't set anything though because I don't know to to. Any tutorial please?)

Am I missing something? Please help, I'll really need it tomorrow. Thank you! ;)

edit: looks like LED now turns on and up/down buttons also display when I'm using camera :). So I simply adjust dB while recording and that's it? No need to reset camera for changes? I still don't know how to set up tasker though.
[Nexus 5 Android Development] chdloc:
Looks like you made some good progress!

Yes, simply adjust the gain up or down (probably down) while recording. Just keep an eye on the LED and/or numbers shown in the UI. You don't want to see long periods of red, i.e. input levels greater than -6 dB RMS. No need to reset the camera. Keep in mind, though, that the next time you hit the "record" button, your gain will automatically reset to the default levels, i.e. the ones found in mixer_paths.xml.

To clarify: you need to setup either the app (apk) or the Tasker project, not both. Looks like you have successfully installed the app, so there is no need to set up Tasker, at least not for your event tomorrow. Also note that the app is really a background process, and the app only shows an UI when the camcorder is running.

With respect to Tasker tutorials: there are quite a few floating around the web. Unfortunately, Tasker has a rather steep learning curve. But believe me, it is worth going through the growing pains. Good luck!
[Nexus 5 Android Development] mcgrave:
Without root it's also possible to install it? Backup without TWRP is possible?
[Nexus 5 Android Development] chdloc:
You don't have to have root to install and run the mod. (You do have to have root to run aMGC, though.)

However, without root, the only way to install it is via custom recovery using the installer available here.

To answer your other question: yes, you can backup all files in /system without TWRP by using adb.
[Nexus 5 Android Development] krneki10:
App does a perfect job, so I'll just skip this tasker part ;). May I remove busybox now? Which apps are currently supported by aMGC for video and audio recording? IIRC Cinema FV-5, stock camera app and easy voice recorder? Does cinema FV-5 produce better video quality than stock camcorder app?
[Nexus 5 Android Development] chdloc:
aMGC depends on busybox, so you may want to hang on to it.

In the current release, only "Google Camcorder" and "Cinema FV-5" are supported. A future update will also support "Easy Voice Recorder Pro".

The reason I like Cinema FV-5 over the stock camcorder is that it does not keep refocussing unnecessarily, thereby producing less "jittery" video.
[Nexus 5 Android Development] ursubpar:
Edit: Nevermind
[Nexus 5 Android Development] krneki10:
While it works great on stock camera, it doesn't seem to work with Cinema FV-5 v1.33 in my case. dB buttons simply don't show up. Do I need to change any settings in app?
[Nexus 5 Android Development] chdloc:
Sorry, I have failed to mention that aMGC currently only supports the "Pro" (paid) version of Cinema FV-5. Do you happen to have the "Lite" version installed?
[Nexus 5 Android Development] chdloc:
FYI, I added an option to enable sidetone for handset use cases to my previous sidetone post.

It works great for me, but note that I have disabled dual-microphone processing (ANC) on my Nexus 5.

I have not tested this particular mod extensively with ANC enabled. Depending on where in the signal path the microphone signal is copied from (before or after ANC), you may encounter issues in noisy and/or windy environments.

I'd be interested in hearing your feedback on the feedback (sidetone).
[Nexus 5 Android Development] krneki10:
No, I have Pro v1.33, so it should work. Do you use default settings in Cinema FV-5?
[Nexus 5 Android Development] chdloc:
I use the default audio settings. Please save your logcat right after you have hit the shutter button and PM it to me for analysis.

Edit: Did you install the latest version of the mod available in the OP or here (Aroma)?
[Nexus 5 Android Development] krneki10:
Could anyone please explain how to use this mod together with Viper4Android? I'd really appreciate it since both mods are awesome ;).
[Nexus 5 Android Development] derboedi:
I use V4A as a flashable ZIP. When I flash a new rom I flash the camcorder mod first and then V4A. But to be honest I'm not sure if that's the best way. Maybe someone else has a better solution.
[Nexus 5 Android Development] otavioricciotti:
About surround speakers mod: it is stereo, right? An option for dual mono would be nice. Sometimes I can't hear sounds well with the ear speaker (one friend has a problem with WhatsApp audios. it is recording as stereo, but only left mic works. so when he sends any audio, just ear speaker plays it, which is a bit annoying).

Is this possible? If not, thanks anyway :)

Thanks for supporting!
[Nexus 5 Android Development] chdloc:
In order to have dual-mono playback instead of stereo, replace the following "speaker" section of your mixer_paths.xml file

<path name="speaker">
<!-- chdloc: stereo version. On my device, 8 dB (8 ticks) of level delta between the earpiece and -->
<!-- main loudspeaker seems to be resulting in a balanced stereo image -->
<ctl name="SLIM RX1 MUX" value="AIF1_PB" />
<ctl name="SLIM RX2 MUX" value="AIF1_PB" />
<ctl name="SLIM_0_RX Channels" value="Two" />
<ctl name="RX1 MIX1 INP1" value="RX1" />
<ctl name="RX7 MIX1 INP2" value="RX2" />
<!-- chdloc: earpiece level; on my device, any value higher than 89 -->
<!-- results in audible distortion -->
<ctl name="RX1 Digital Volume" value="89" />
<!-- chdloc: main loudspeaker level -->
<ctl name="RX7 Digital Volume" value="81" />
<ctl name="SPK DRV Volume" value="6" />
<ctl name="CLASS_H_DSM MUX" value="DSM_HPHL_RX1" />
<ctl name="DAC1 Switch" value="1" />

<!-- chdloc: added high-pass filter with a 150 Hz cut-off frequency -->
<!-- the idea is to lower distortion by preventing the codec -->
<!-- to send frequencies the loudspeaker cannot reproduce anyway -->
<ctl name="RX1 HPF cut off" value="MIN_3DB_150Hz"/>
<ctl name="RX7 HPF cut off" value="MIN_3DB_150Hz"/>
<ctl name="RX2 HPF cut off" value="MIN_3DB_150Hz"/>
</path>

with

<path name="speaker">
<!-- chdloc: dual-mono version. You may need to play around with the RX1/RX7 Volume settings -->
<ctl name="SLIM RX1 MUX" value="AIF1_PB" />
<ctl name="SLIM RX2 MUX" value="AIF1_PB" />
<ctl name="SLIM_0_RX Channels" value="Two" />

<ctl name="RX1 MIX1 INP1" value="RX1" />
<!-- cross mix for dual mono -->
<ctl name="RX1 MIX1 INP2" value="RX2" />
<!-- cross mix for dual-mono -->
<ctl name="RX7 MIX1 INP1" value="RX1" />
<ctl name="RX7 MIX1 INP2" value="RX2" />

<!-- chdloc: earpiece level; on my device, any value higher than 89 -->
<!-- results in audible distortion -->
<ctl name="RX1 Digital Volume" value="89" />
<!-- chdloc: main loudspeaker level -->
<ctl name="RX7 Digital Volume" value="81" />
<ctl name="SPK DRV Volume" value="6" />
<ctl name="CLASS_H_DSM MUX" value="DSM_HPHL_RX1" />
<ctl name="DAC1 Switch" value="1" />

<!-- chdloc: added high-pass filter with a 150 Hz cut-off frequency -->
<!-- the idea is to lower distortion by preventing the codec -->
<!-- to send frequencies the loudspeaker cannot reproduce anyway -->
<ctl name="RX1 HPF cut off" value="MIN_3DB_150Hz"/>
<ctl name="RX7 HPF cut off" value="MIN_3DB_150Hz"/>
<ctl name="RX2 HPF cut off" value="MIN_3DB_150Hz"/>
</path>

You may need to adjust the respective speaker volume settings, i.e. "RX1 Digital Volume" and "RX7 Digital Volume" to your taste.
[Nexus 5 Android Development] explorer-10:
Will this work on 5.0.2 custom aosp roms?
[Nexus 5 Android Development] chdloc:
Hard to say. It depends on how closely the custom ROM that you are considering follows AOSP. The fact that it is 5.0.2 instead of 5.0.1 is very likely irrelevant.

The only way to find out is to install the mod and see what happens. I'd suggest you start with the simple mod (the one without noise suppression). The probability of that one working on any 5.0.X non CM/CAF-based ROM is pretty high.
[Nexus 5 Android Development] explorer-10:
I'm trying out this rom: http://xdaforums.com/google-nexus-5/development/rom-t3023424 + ElementalX v2.10
[Nexus 5 Android Development] otavioricciotti:
Thanks chdloc for your solution. Dual mono seems a bit better for me. It makes sound more balanced than stereo, doesn't feel like right speakers is so much louder than left speaker.

Good luck!
[Nexus 5 Android Development] chdloc:
Glad it's working for you. It sounds, though, that your stereo setup was not optimized for your phone. In my case, both loudspeakers have virtually identical levels, provided the phone is held in landscape orientation.
[Nexus 5 Android Development] eddie_gordo:
Hi... I need some advise.. This is what my Nexus 5 sounds like whenever I record a video:

https://www.youtube.com/watch?v=J-2kjjW25kE

It seems a bit worse than others that I've seen/heard but it could be just me being nitpicky with my phone. It sounds like I'm under water or something like that, the noise in real life was nowhere similar to what I have in the video. Do you think that this mod would help on this matter, or is my Nexus faulty and I should RMA it?

In the case that the mod can solve this, I only need to flash the v2 zip in recovery, right? :)

Thanks!
[Nexus 5 Android Development] aeoveu:
Have you tried flashing the mod? You'll only know if you try.
[Nexus 5 Android Development] eddie_gordo:
By the time I've posted I hadn't. I flashed some minutes ago, and I'll try to test it to see if it solved the issue. I didn't change any of the options when installing, left them all at default. I hope those are the "recommended" settings. :)

Thanks for the good work, I'll post an update when I have the time to proper test if it helped with the audio recording. :)
[Nexus 5 Android Development] eddie_gordo:
Ok, it seems to have solved my problem also. :D Here are two videos for comparison...

Before

https://www.youtube.com/watch?v=J-2kjjW25kE

After

https://www.youtube.com/watch?v=IE4q76lfT4s

If you have nice headphones you'll notice a big difference. :)

Thanks for the good work guys!