yashsingh1/xdaforums huggingface dataset:
[Nexus 5 Android Development] chdloc:
You can find the volume controls for the microphones in the "camcorder-stereo" device. There are two controls per microphone, an analog and a digital one:

Top microphone: "ADC3 Volume" for analog (ranges from 0 to 19) and "DEC4 Volume" for digital (ranges from 0 to 124)

Main microphone: "ADC1 Volume" for analog and "DEC6 Volume" for digital

Each "tick" for the analog control changes the gain by 1.5 dB and each "tick" for the digital control changes the gain by 1 dB. If you kept the "stock" settings, the analog gain is 15 and the digital gain is 97. If you need to knock down the gain by 60 dB (you can always add some gain in post-processing if necessary), I would set the analog gains to 0 and the digital ones to 60. This would give you 59.5 dB of attenuation compared to stock.
[Nexus 5 Android Development] [Gorgasm]:
Thanks for the tip, I will give it a try soon !
[Nexus 5 Android Development] Bonoboo:
Many thanks for solution!

Basing on thread created patch for Xiaomi Redmi 3S with same sound problem.
[Nexus 5 Android Development] Chudovische:
Hello, chdloc.

Is it possible to get stereo recording on Cyan 14.1 CAF (Android 7.1)?
[Nexus 5 Android Development] chdloc:
Yes. Post the following two files of the ROM you are running:

/system/etc/mixer_paths.xml

/system/etc/media_profiles.xml
[Nexus 5 Android Development] Nolfer:
MOB31K

6.0.1 cyanogenmod 2016 12 22

Can you do an aroma version of the whole thing for this android version pretty please?
[Nexus 5 Android Development] chdloc:
I'd be happy to get stereo playback or recording to work for you as well as give you pointers on how set up the "simple" audio quality fix, but I unfortunately do not have the time develop a new full-blown Aroma installer. Sorry.
[Nexus 5 Android Development] Nolfer:
That will do, thanks!
[Nexus 5 Android Development] chdloc:
Are these the stock CM files? The dual speaker playback mod is already included.

Do camcorder recordings sound poor? If so, please post the following file: /system/etc/audio_platform_info.xml

Only in case that file does not exist and camcorder recordings sound poor, then you can install the simple fix from here
[Nexus 5 Android Development] Nolfer:
The problem is that sound is not stereo; it only comes out of the main speaker. Audio platform info is not present.

I only need the instructions on how to achieve stereo playback (microusb to the right) and how to adjust the gain values of the two speakers to fine tune them. And no noise suppression (0dB) on recording (simple audiofix) at 288kbps bitrate. No sidetone :o
[Nexus 5 Android Development] chdloc:
That is odd since the mixer_paths.xml file you attached previously definitely has the stereo speaker mod. Are you sure you are using that one and that there is no other file with a similar name, such as mixer_paths_*.xml? If not while playing audio through the speaker(s), issue the following commands in a root shell

logcat | grep select_devices

and

tinymix | grep SLIM

and post the results.

Then you can flash the simple mod as I indicated earlier.

The media_profiles.xml file you shared shows that the audio bitrate of a camcorder recording at 720p and 1080p is already set to 288 kbps.
[Nexus 5 Android Development] Nolfer:
u0_a95@hammerhead:/ $ su
root@hammerhead:/ # logcat | grep select_devices
01-18 09:34:14.249 340 1011 D audio_hw_primary: select_devices: out_snd_device(2: speaker) in_snd_device(0: none)
tinymix | grep SLIM
logcat | grep select_devices

logcat | grep select_devices

Stereo playback is now working, thanks. Started working after inputting the tinymix command. Didn't need to flash the simple fix.

How do I change both speakers' gain?
[Nexus 5 Android Development] chdloc:
That's odd. I guess those kinds of quirks show up when running custom ROMs.

In your "speaker" device, change "RX1 Digital Volume" for the earpiece volume and "RX7 Digital Volume" for the main speaker (each "tick" corresponds to 1 dB of gain change). You can use tinymix to find the sweet spot before hard coding it into mixer_paths.
[Nexus 5 Android Development] Nolfer:
Update: nope, stereo doesn't work and didn't work. I tricked myself into believing it was working.

Uhhh... Help.
[Nexus 5 Android Development] chdloc:
The only explanation I have is that CM is doing things differently now, such as using a different mixer configuration file. What is the contents of your /system/etc directory?
[Nexus 5 Android Development] gr-e:
Stereo mod works fine on both cm13 and cm14. It may not work on CAF builds, but these have an audio_platform_info.xml file out of the box. So, that's not the case:

Btw, you can find stock CM files on LineageOS github: AOSP, CAF
[Nexus 5 Android Development] Nolfer:
do you want 4-5 screenshots?
[Nexus 5 Android Development] chdloc:
What makes me wonder is that the mixer_paths file you shared earlier is different from the one found in the CM source tree (via the link that [MENTION=4333661]gr-e[/MENTION] shared). I suggest you start from scratch (re-install "system"). Maybe you can ask [MENTION=4333661]gr-e[/MENTION] for assistance since I have never used CM.
[Nexus 5 Android Development] gr-e:
[MENTION=5566867]Nolfer[/MENTION] try this one
[Nexus 5 Android Development] Nolfer:
Just flashed again today and it worked.

Apparently viper4android caused a bit of a conflict.

That's all I can tell right now.
[Nexus 5 Android Development] 3dfxvoodoo:
The Flashable zip of "simple" camcorder audio fix for Nougat work with Lineage os 14.1?
[Nexus 5 Android Development] chdloc:
Check whether your ROM comes with the file

/system/etc/audio_platform_info.xml . If it doesn't then chances are that the flashable zip works as is. If that file does exist, post it, and I can modify the installer for you.
[Nexus 5 Android Development] 3dfxvoodoo:
Thank´s chdloc, i check the file: lineage-14.1-20170131-nightly-hammerhead-signed.zip and don´t have the file "audio_platform_info.xml", so i flash your zip file "simple" camcorder audio fix for Nougat with TWRP Recovery and work fine.

I make two videos, one without the fix and It sounds very bad, bu the video with the fix Sounds perfect!. This weekend begins the carnival in my city so :laugh: :laugh: :laugh:...., thank you very much.

Cheers from Corrientes - Argentina
[Nexus 5 Android Development] Vothana:
Hi bro! Could you modify for me? Hêre the file and thank you
[Nexus 5 Android Development] chdloc:
Did you read my theory around unplugging a headset firing up the speakerphone?

http://xdaforums.com/showpost.php?p=54921745&postcount=80
[Nexus 5 Android Development] aeoveu:
I did. And I read the ending more carefully now :) I know you investigated the problem - I was just lamenting on the fact that if this bug (which isn't your fault as such) was sorted, it'd be great. :) I wonder why it happens with your mod though.

BTW, if I may ask, can this be turned into an xposed module? That would make it less permanent, and we could potentially be able to change the gain from the GUI without flashing repeatedly.
[Nexus 5 Android Development] kevev:
This mod does not cause the headphones issue. I have the headphones issue without this mod. An xposed module for the camcorder audio mod would be awesome.

Sent from my Nexus 5
[Nexus 5 Android Development] chdloc:
It is impossible that my mod causes the headphone/headset issue that people have mentioned as it

does absolutely nothing outside the "CAMCORDER" device mode.

I just ran some tests again and I'm now fairly confident that the culprit is Hangouts. You can try yourself by

freezing Hangouts with Titanium Backup and try to reproduce the problem again. I believe there is no

way to fix this other than to hope that Google updates Hangouts to address this issue.

There are workarounds, though, which can be achieved with Tasker.

Don't know about Xposed. I have never used it.

The only way to make my mod less "permanent" is to teach the system

to read-in mixer_paths.xml upon every start of the camera app. Currently, this file is read and applied

during a system boot process.

If you are adventurous, you can try the Tasker scene that I shared a few posts back. It shows a floating

UI that allows for on-the-fly gain adjustment.
[Nexus 5 Android Development] aeoveu:
Well - I'll just have to test the hangouts issue without the mod...but another day. For now, I'm sticking to this mod :)
[Nexus 5 Android Development] chdloc:
Have you tested whether audio gets routed correctly after Hangouts has been frozen?

With or without my mod. This should not make a difference...
[Nexus 5 Android Development] aeoveu:
I realize you may think I'm insinuating you for the bug - that's not my aim (and I need to use better words), so don't mind me, please.

I'll try testing it tomorrow. I haven't had anyone chat with me on hangouts since I restated my phone yesterday.

And FCing hangouts...let's test your suggestion first before I continue with my speech that may insinuate you for causing this bug again lol (sorry).
[Nexus 5 Android Development] d0pefish:
I compiled a version of tinymix for anyone using Android-L and unable to use the version in the first post because of the PIE (position-independant code) restrictions. :)

Just thought I'd attach it here in case anyone needs it.

@OP: Awesome work in solving this, thankyou! It's been a really annoying problem that didn't seem to be taken very seriously before, so many thanks for the fix. :)

I'm working on a simple Java app to manipulate the XML values and invoke tinymix. If I get anywhere I'll post the app/code.
[Nexus 5 Android Development] chdloc:
Hey, no worries. No offense taken.

I just want to make sure that all users of my mod are happy campers...;)
[Nexus 5 Android Development] chdloc:
Great!

Please keep in mind that your app needs to float on top the camcorder app as (at least in my testing)

- to have an effect, an update of the XML values requires a reboot

- the default XML values are applied upon starting a new recording

- a recording stops as soon as the camcorder app moves to the background
[Nexus 5 Android Development] chdloc:
Fair comparison of camcorder audio

I have made and attached a few recordings with which the sound of the camcorder using the stock audio

library and the one using my mod can be compared. I made sure that the recordings were made under identical circumstances.

Measurement setup:

Two Fostex 6301 loudspeakers, one playing a speech signal, and the other one (at a somewhat lower level) music.

Both were about six feet from the Nexus 5. Right next to the Nexus 5 I positioned a lab-grade sound level meter with

recording capabilities (Bruel & Kjaer Type 2250) which serves as a reference.

I made sure that I did not move the setup while enabling/disabling my mod. For the recording levels with my mod I chose

DEC6=103 which results in a decent match with the stock levels.

The recording itself (the three audio files in the attached archive) starts with about 5 seconds worth of background noise. In the reference and in

the mod you can actually hear crickets chirping in the background. The stock library completely removes that as well as quite a bit of the music.

It is clear that the noise level produced by the modded library is significantly higher than the one produced by the stock library,

which is due to a noise suppression algorithm that squashes signals deemed as noise by about 20 dB. The bad news is that

the noise suppression badly mangles all other signals as well.

You be the judge as to which one sounds better.

My suggestion to Qualcomm/LG/Google would be to lower the noise suppression to a max of about 6dB.

(And for the future, use a lower-noise acoustic front-end.)
[Nexus 5 Android Development] luckana:
is there a a way to increase in-call volume but not increasing all system sounds.. Everything got sooo loud and i had to revert
[Nexus 5 Android Development] chdloc:
That is very odd behavior and my mod should not change any playback levels.

Your signature suggests that you are running Mahdi, which is based on CM, I believe.

Which version of the mod did you apply? I think you would have to try the CM version.

Of course, there is a possibility that my mod does something unexpected on ROMs other

than stock and CM11, although I have received reports of this mod working on all kinds of

ROMs as mentioned in the OP.
[Nexus 5 Android Development] omvir:
I don't use the nexus 5 anymore, but I still read the the kernel threads as I find them interesting/entertaining sometimes. And on the latest r62 test boot image for Franco kernel, a few people have seen an increase in in-call quality, and overall sound quality... I think you should give it a run and see how much it actually improved. I'll edit this post with a link.

Edit: http://kernels.franco-lnx.net/Nexus5/4.4/tests/
[Nexus 5 Android Development] d0pefish:
Thanks for confirming that - I had my suspicions that the XML is read by the media framework on startup and its values cached until reboot.

I have some rough code successfully parsing-out the values for the mic-mod gains from XML, plus I'm able to run tinymix by dragging some sliders.

I've been thinking of some solutions for live gain control for the camcorder, as I don't have Tasker (though I really should get it, it looks very useful!).

One is the floating app idea - somehow intercept Camcorder launches/intents, override mixer values and allow on-the-fly adjustments.

I wonder if having a MediaRecorder running as a background service is possible, to potentially keep the camcorder path set? Need to see if starting another recording will reset the mixer values.

Or, hack on something like OpenCamera and add some on-screen controls and hooks to override the mixer settings on record. That might be relatively quick to do, I might give that a go!
[Nexus 5 Android Development] nicholaschan24:
I have just tried this and it seems to have done the trick!
[Nexus 5 Android Development] chdloc:
I ran Franco's r62 test kernel (dated August 25) and made the same recordings as before and honestly, I cannot hear a difference between

the stock kernel and Franco's test kernel in the camcorder audio. It is just as bad. I also tested the RX distortion issue that plagues call

recording apps that capture from the line. It, too, is still present.

I cannot comment on the in-call TX voice quality as I have not tested that one extensively. I did notice, though, that music playback levels

are higher, in turn resulting in higher playback distortion.

Unless Franco has access to detailed documentation on the MSM8974 audio pipelines and associated audio parameter optimization tools

from Qualcomm and/or LG I doubt that he (or anyone else outside the Qualcomm/LG world for that matter) can truly fix the fundamental

audio issues that plague the MSM8974 in general and the N5 in particular.
[Nexus 5 Android Development] marquimsp:
Hey chdloc do I have to flash your mod again after updating the kernel?

thanks!
[Nexus 5 Android Development] chdloc:
Nope.
[Nexus 5 Android Development] SOHKis:
many thanks again for this, can't believe more aren't utilizing it..
[Nexus 5 Android Development] chdloc:
The XML file you attached already has the mod in place.
[Nexus 5 Android Development] tenghc:
Hi there,

Can you help me to mod my phone to have stereo mod? This is from Euclidean Os android 7.1.1. Here I uploaded the original xml files I found in system/etc/. Thanks in advance!
[Nexus 5 Android Development] chdloc:
Are you interested in the dual-speaker playback mod or the stereo camcorder recording mod?
[Nexus 5 Android Development] tenghc:
Thanks for the fast reply [MENTION=2760454]chdloc[/MENTION]! I wish to have dual speaker playback mod. Much appreciated!
[Nexus 5 Android Development] chdloc:
Try the attached flashable zip.

You may want/need to adjust the speaker gains to find the balance/distortion compromise that works for you. See this post for instructions, but download the required tinymix command line app from here; the one labelled tinymix_lollipop.tar.gz.
[Nexus 5 Android Development] tenghc:
Wow! Thanks a lot! Didn't expect you made a flashable zip for this one.. :fingers-crossed::good:
[Nexus 5 Android Development] lordc:
Hi! [MENTION=2760454]chdloc[/MENTION]

Do you believe that audio recording on lg g4 can be improved in a similar way that this mod?

Sorry for the partial offtopic

Enviado desde mi LG-H815 mediante Tapatalk
[Nexus 5 Android Development] chdloc:
PM me a sample of the audio recording coming from your phone.
[Nexus 5 Android Development] lCrD512:
Thanks for this Mod!! :D
[Nexus 5 Android Development] cameronnz:
I wonder if anyone else is using Magisk and has had sucess turning the aroma installer into a Magisk module? I have had a look at trying to do this but not sure if I'm grabbing all the appropriate files from the zip :eek:

Any help appreciated

Cameron
[Nexus 5 Android Development] qwyjibof:
Hi, fellos! Is it possible to apply audio patch on unrooted device on Marshmallow 6.0.1 (M4B30Z) through TWRP? I want just to fix bubbly video recording!
[Nexus 5 Android Development] chdloc:
You should be able to flash the "simple mod" via TWRP which, once installed, will not need root to function.
[Nexus 5 Android Development] qwyjibof:
Thank you!
[Nexus 5 Android Development] DonAndress:
Thanks to your awesome tips I managed to fix too quiet recording on LOS14.1 ! :D

Again - thank you!

There is one more thing that may require fine tuning though.

On LOS my Samsung i9506 records to much of low tones comparing to stock rom.

Is there any setting in the mixer_paths.xml or anywhere else which I could reduce that with?
[Nexus 5 Android Development] chdloc:
What you are describing likely means that LOS uses a differently calibrated microphone "device ID" in the CAMCORDER use-case than stock.

This can be adjusted by painful (each modification requires a reboot) trial-and-error modification of the ACDB ID that is likely listed in /system/etc/audio_platform_info.xml. Note that the effect of different ACDB IDs -- or which numbers are even valid -- is completely undocumented.
[Nexus 5 Android Development] DonAndress:
So you would suggest to get over it and use as it is?

It's not very bothering after all. Just a bit too much low tones.

TapaTalked from i9506
[Nexus 5 Android Development] chdloc:
As long as the prominent bass does not distort the audio in general I'd leave it and potentially post-process as necessary.
[Nexus 5 Android Development] human75:
Hi Guys.

After i flashed with simple fix no more sound at my ZUK Z2 pro.it runs on Custom AICP Nougat 7 rom?is there any way to fix?Anybody can help?Many thx in advance.
[Nexus 5 Android Development] jacomail95:
You should be aware you are in a Nexus 5 thread and not a Zuk Z2 one, first, and you installed a mod NOT designed for your device at all. Second, delete the file you flashed and reboot.

Inviato dal mio Nexus 5 con Tapatalk 2
[Nexus 5 Android Development] human75:
Yes i am aware i m in nexus 5 forum.thx for reminding me again:).i asked kindly if is there anyway to fix or modify this mod according to our device.regards
[Nexus 5 Android Development] antoniod4g0:
Hi guys i have the same problem with nubia z11, that is when recording music the sound goes distorted and grabs. I tried to change some values by looking at nexus 5 but of course many things are different. I'm desperate, I've tried everything. If you can look at the following files, I would also be willing to give a small donation. thank you so much

https://www.dropbox.com/s/flx6p537cu2p5jf/nubia z11 mic problem.rar?dl=0
[Nexus 5 Android Development] chdloc:
You can try the approach described here.

Your phone may already have the required file, i.e. /system/etc/audio_platform_info.xml. If so, add the entry

<device name="SND_DEVICE_IN_CAMCORDER_MIC" acdb_id="89"/>

somewhere between the <acdb_ids> tags. The value of 89 works for the Nexus 5. It may (even likely) not work for your phone. In that case you need to experiment with the number. Start with 61 as this is the number used in AOSP (audio recording now sounds fine on the Pixel). If that does not work, it can be pretty much anything. Without seeing the source code for the audio HAL used for your phone it is impossible to even suggest possible numbers to try. You will have to change the number, make sure that the file permissions are 644 (rw-r--r--), reboot your phone, make a recording and listen for changes. Rinse and repeat until you find a number that works for you.
[Nexus 5 Android Development] zhossein:
PLEASE CONSIDER stereo recording fix for nougat roms

Dear developers, please provide stereo camcorder mod for nougat based Roms, simple fix for nougat roms won't suffice.:crying::crying:
[Nexus 5 Android Development] chdloc:
Are you only interested in adding stereo recording to the simple fix? If so, then post your system/etc/mixer_paths.xml and /system/etc/media_profiles.xml from your Nougat-based ROM.

Please note that, due to the number of ROMs available for this device, I'm not supporting the "advanced" mod for ROMs other than stock, which ended with Marshmallow for this device.
[Nexus 5 Android Development] zhossein:
thanks for replying in such short notice.

YES. that's exactly what I'm interested in: adding stereo recording to the simple fix.

before you mentioned these two system files i spent lots of time finding and narrowing down, comparing the changes from marshmallow older releases to stock files.

if you can patch my system files to enable stereo recording i would really appreciate it

I'm currently using lineage-14.1-20170704-nightly-hammerhead Rom.

UPDATE: no attachment button or option appeared in reply page and xda wont let me post outside links.

If possible would you guide me through patching these files so i can patch other roms on my own?

Nexus 5 owners are thankful for your support to our beloved nexus 5
[Nexus 5 Android Development] gr-e:
These files work just fine on lineage os.
[Nexus 5 Android Development] zhossein:
thanks a lot
[Nexus 5 Android Development] gr-e:
Yep.
[Nexus 5 Android Development] qwyjibof:
I'am using lineageos too. One little question. To correct “bubbly” effect in video tracks must be installed simple audiofix for nougat (audio_platform_info.) or enough to change system files (system/etc/media_profile.xml and system/etc/mixer_paths.xml)?
[Nexus 5 Android Development] dromango:
I have build number M4B30Z android 6.0.1

I flashed my phone back to stock and I wonder what file I should download so I can flash in TWRP recovery or ADB.
[Nexus 5 Android Development] chdloc:
The archive labeled Nexus5_6.0.1_MBB29K_v1.0_audiofix_aroma.zip available here should work for you.
[Nexus 5 Android Development] rsmarx:
Hello chdloc everyone! I'm new in this kind of mod stuff, and I wonder is there some kind of video showing what to do to remove the "underwater" sound of the recorded videos?

First I got used with this sound, but now, it's bugging me.

Thanks!! :)
[Nexus 5 Android Development] chdloc:
All you need to do is to flash the zip in recovery. You should be able to find plenty of guides on how to install flashable zips.
[Nexus 5 Android Development] rsmarx:
Thank you for the reply!

I'll look for this videos, but just to clarify, I have to root the phone and install CWM or TWRP, right?

Thanks!
[Nexus 5 Android Development] chdloc:
This mod is untested with CWM, so I would highly recommend installing (or booting into) TWRP.

If you only want to use the "simple" mod, you technically do not have to be rooted. You do need root for the aMGC part of the "advanced" mod, however.

See the OP for a detailed explanation of the available options.
[Nexus 5 Android Development] rsmarx:
Great, so I'll test the "simple" fix.

I checked the OP and I follow one post of yours explaining the "New simpler "simple" mod" but I didn't get how to add the file called audio_platform_info.xml into the phone.

Could you please give me instructions how to do it?

Thank you!