4.3-4.4 AOSP Camera app with Auto-gain audio - Android Software/Hacking General [Developers Only]

Anyone here used a Motorola device with stock camera app using "Concert" mode and been able to record crystal-clear audio in a noisy environment without distortion? Whether you have or not, it works very well an I am trying to figure out how to get similar results with my Qualcomm based AT&T branded Galaxy S4 running Cyanogenmod 11 latest nightlies. It'd be great to find out if any solutions will work for other devices as well. I know very well that iOS devices can record video in noisy environments flawlessly without having to change any microphone settings at all.
To begin, the stock touchwiz configuration and AOSP-based rom configurations currently capture extremely distorted audio when you are in loud environment on the Galaxy S4, quite certain most all of the other Galaxy devices as well. In a quiet environment, the audio capture is awesome and in 2 channel stereo.
Digging into the audio configuration file, I've found many parameters that can be adjusted, changed, replaced, etc.
The file /system/etc/snd_soc_msm/snd_soc_msm_2x_Fusion3 is the audio configuration file.
It can be open and edited directly on the device using any text editor.
Here is the settings for the "camcorder" profile when recording video in the camera app:
Code:
[B][COLOR="DarkRed"]SectionDevice
Name "Camcorder Tx"
Comment "Camcorder Tx device"
EnableSequence
'SLIM_0_TX Channels':0:Two
'SLIM TX7 MUX':0:DEC3
'DEC3 MUX':0:ADC4
'ADC4 Volume':2:91.7%
'DEC3 Volume':2:84%
'SLIM TX8 MUX':0:DEC4
'DEC4 MUX':0:ADC3
'ADC3 Volume':2:91.7%
'DEC4 Volume':2:84%
'MICBIAS3 CAPLESS Switch':1:1
EndSequence
DisableSequence
'SLIM TX7 MUX':0:ZERO
'DEC3 MUX':0:ZERO
'ADC4 Volume':1:0
'DEC3 Volume':1:67%
'SLIM TX8 MUX':0:ZERO
'DEC4 MUX':0:ZERO
'ADC3 Volume':1:0
'DEC4 Volume':1:67%
'MICBIAS3 CAPLESS Switch':1:0
EndSequence
ACDBID 56:2
EndSection[/COLOR][/B]
Adjusting volume percentages does result in differences in recording levels of the left/right channel, but what I am really looking for is the possibility of using Auto-gain control. I have read over and over that the audio hardware of these qualcomm processors do have auto-gain control in the audio processing. Does anyone know the perimeters here that enable it?
Apps like Tapemachine (a very awesome audio recording and editing app https://play.google.com/store/apps/details?id=com.samalyse.free.tapemachine ) has an option for Auto-gain control. Is this app using a hardware based auto-gain control or is it rendering within the app? Either way, any information leading towards the development of auto-gain control in video/audio recording in AOSP android would be great help. I'm not much of a programmer but I'm willing to dig into putting work into the AOSP camera app to enable this feature.
Thanks for reading.
-Steve

Changing the volume sensitivities in the lines above to something lower, ~54ish percent dramatically improved the audio recording in loud environments. The audio in my vehicle is really loud, figured it was a good place to test it. Before modifying the file, the sound was entirely inaudible distortion.
This works very well, it's just a drag to have to edit the file manually, reboot, and then go back to camera app and then record to get different levels of audio capture sensitivity.
Anyone want to help out with being able to control audio gain in video recording?

I'm looking for that too...
Do You compare gain and quality audio in video in Stock (Galaxy S4) and AOSP camera?

Camera App Name
Hi Steve,
I found your post very interesting. The issue is, I am not finding the camera app you are referring to (I am looking for an app with the possibility of lowering mic gain).
Thanks a lot!!
Juan

Related

[DEV] media_profiles.xml modding (improve picture&video quality)

Hi,all .
I'm trying to modding media_profiles.xml for desire s because this thread
http://forum.xda-developers.com/showthread.php?t=1065992
(some time i use phone cam to record my piano so sound quality is important )
This is what i change from original file
Main Cam / Front Cam
Audio
- Change Audio Codec from amrnb to aac (for high quality)
- 2 channel(stereo)
- Increase Bit Rate to 128kbps and SampleRate to 44.1k
Image
- Change Image Encoding Quality to 100/95/90
Video
- Change height&width to match 720p size and bit rate to 17000000 for main cam
- Change height&width to match VGA size and bit rate 4000000 for front cam
Testing with VoidU S 1.1a it work perfectly audio in video improve a lot! and i can use stereo recordring now (stock kernel)
Feel free to test but! Don't forgot to backup original before use adb to push file to /system/etc
**seem to be not working with UnityV9 (Stereo Recording) but on stock kernal it work perfrectly!**
How strange, I was just modding this file this morning.
I was able to successfully mod the file too and improve audio quality in camera recordings, but what I actually want to do was improve the sound quality when using the stock voice recorder. Any ideas?
I just test with Unity Kernel. It seem like unity doesn't support Stereo Recording! :/
Is this fix possible to apply also on MIUI rom?
Can you not increase image quality from this file?
Sent from my HTC Desire S using xda premium

[MOD] 2.3.6/7 Video Recording audio improvement -- WIP

Hi everyone
when you record a video on your original SGS 4G camera, your audio sampling is :
66 kbps bit rate.
16 KHz sample rate.
which is pretty lame...
If you ever tried to record live shows or concerts, you probably noticed audio is awful on recorded video...
Introducing Video Recording audio improvement MOD
found and very well explained by rafalense (http://forum.xda-developers.com/showpost.php?p=10980448&postcount=268).
Performed on SGS 4G camera by me. So, now recorded audio sampling is :
118 kbps bit rate.
32 KHz sample rate.
file size change is barely noticed.
Still camera is not modified.
I took, as a basis, the Team Acid modified camera - done by DSexton702.
So it is capable of taking pictures when battery is low and also by using the power button.
This is still in beta as :
1. Currently Audio-Video is out of sync. I need to check if this can be fixed by changing Video sampling rate....
In the meanwhile, you can fix this on PC very easily.
2. This mod does not use the media profile xml for greater video frame rate.
I actually put the original file back. I found the result to be not supported by all players and having some side effects like visual waves (and much larger file size).
3. Actually I examined DSexton702 media profile and it defines some various audio sample rates but always create 16KHz at the end.
If someone here has the knowledge in A/V synchronization or a good setup that works - please let me know so i will fix it.
Thanks.
CWM Flashable files to download (Camcorder mod and original camcorder to revert back) :
You can use this to sync A/V - http://fixounet.free.fr/avidemux/download.html
Awesome work! Thanks.
Glad to have u aboard thanks for this man this is well needed!!!!!
Now having AntonX kernel supporting Vodoo Sound - I will test audio HiFi record option enabled on video recording and update.
Would love to see this become final. You certainly are right about the audio during concert recording. All we hear is pure bass... Thank you for working on a much needed video recording mod.
Eurik said:
Would love to see this become final. You certainly are right about the audio during concert recording. All we hear is pure bass... Thank you for working on a much needed video recording mod.
Click to expand...
Click to collapse
Yeah.. would be awesome.
Thanks for the work, itzik2sh.
Edit : guys working with Voodoo sound (with supporting kernel)
need to run the Voodoo sound app and choose 'Recording Preset' - then change default to 'Loud environment - with DRC'
This should improve the recording level of loud shows.
Hi
Did anyone here test this MOD with live concert recording ?
If it doesn't help than I'll drop all further work.
I thought this problem is SGS 4G unique, but it turns out it exists on all Sammy phones,
even Nexus and SGS 2. See this bounty thread for SGS 2 :
http://forum.xda-developers.com/showthread.php?t=1172048
and this :
http://forum.xda-developers.com/showthread.php?t=896826
I'll try to ask AntonX to take a look or maybe ask supercurio on kernel implementation...
I also tried installing LGCamera from the market, which supposingly has an audio gain control, but it fails to launch and I had to uninstall it.
Nice improvement
Sent from my SGH-T959V using xda premium
Very good, very like
itzik2sh said:
Edit : guys working with Voodoo sound (with supporting kernel)
need to run the Voodoo sound app and choose 'Recording Preset' - then change default to 'Loud environment - with DRC'
This should improve the recording level of loud shows.
Click to expand...
Click to collapse
After voodoo digital recording, video and audio are repacked and converted to the device analog sampling rates, that this tweak changes (but also unsyncs)...
So if you have the time and effort, I'd appreciate if you share your experience with us all.
Sent from my SGH-T959V using xda premium

[Q] CM/AOSP Camera vs Motorola Camera app

There is a way for porting motorola camera app to aosp/CM roms??
I would love to use CM roms like CM11, but the camera quality is disgusting in the dark, the lack of HDR implemented by motorola app is a big is a big lack for night shots.
Also the "concert mode" for video capturing in motorola camera app is sublime (excellent audio recording for concerts).
I have LG camera Pro, that is better than standard CM/aosp camera (in my opinion).
But I would love to see the port of motorola camera app.
I think that the motorola framework is needed, but I see that for some samsung galaxy devices someone ported samsung camera to CM roms.
No one is interested?
Have you tried Focal?
Sent from my XT897 using xda app-developers app
FinntheViking said:
Have you tried Focal?
Sent from my XT897 using xda app-developers app
Click to expand...
Click to collapse
Yes, good camera app but have some bugs now.
For now I use LG camera pro, but I miss original motorola camera HDR and concert mode with video recording.
Would like to see original motorola camera on AOSP/CM roms.
I would do it myself but I don't know how to port applications that requires original moto framework
nagash91 said:
Yes, good camera app but have some bugs now.
For now I use LG camera pro, but I miss original motorola camera HDR and concert mode with video recording.
Would like to see original motorola camera on AOSP/CM roms.
I would do it myself but I don't know how to port applications that requires original moto framework
Click to expand...
Click to collapse
I am also very interested in this. I think it's bullcrap that an iPhone has auto-gain control in all their devices able to record crystal clear audio in very-loud environments. The Motorola devices with moto-camera app have "concert" mode that lowers the gain of the mic-inputs and dramatically improves audio capture for video in loud environments.
I am running Cm11 on my S4 and trying to get same results. I have found one way to manually change microphone sensitivity for the "Camcorder" audio profile in the system.
/system/etc/snd_soc_msm/snd_soc_msm_2x (or similar filename depending on device&rom) has all of the mixer profiles of inputs and outputs for audio.
Changing the audio level percents under
Code:
Name "Camcorder Tx"
Comment "Camcorder Tx device"
EnableSequence
'AIF1_CAP Mixer SLIM TX7':1:1
'SLIM_0_TX Channels':0:eek:ne
'SLIM TX7 MUX':0:DEC3
'DEC3 MUX':0:ADC4
'DEC3 Volume':1:76
'ADC4 Volume':1:100
'MICBIAS3 CAPLESS Switch':1:0
EndSequence
from 76 to something like 47 allows my S4 to capture LOUD audio in crystal clear form.
I have noticed that motorola versions of the snd_soc_msm_2x file have multiple "Camcorder TX" profiles, I'm going to guess each one has different sensitivities, maybe this has to do with "concert mode" in the camera app focusing on different audio profiles in the snd_soc_msm_2x file. I know that this can be copied over to other devices as well, especially that moto roms are very close to AOSP.

How to screenrecord on CM11 with sound?

Hi,
I've tested the built-in 'screenrecord' binary of CM11 and it works quite well but it lacks sound. Is there any solution/app that enhances this functionality with sound support? The new app 'mirror beta' just seems to provide mic audio that i don't want. I need system audio to record games and such. Any ideas?

[MOD][ROOT] Stereo Audio Recording

This is a mod to enable stereo audio recording with camcorder.
This isn't my work actually, it's done by @chdloc, i was looking for something like this and found his thread for nexus 5 and asked if he can make it for nexus 5x too. and he did it :good: so please give him thanks instead of me
Requirements:
Root
A file explorer ( i use solid explorer)
Installation:
make a backup of your stock media_profiles.xml and mixer_paths.xml files (attached in the "stock_files" archive for convenience)
manually push the two files in the "Stereo_audio_mod_nexus5x" archive to /system/etc/
adjust the permissions of the two files to 644 (rw-r--r--)
reboot
These are not flashable zips For flashable zip see post #2.
Enjoy stereo audio in all videos you record
Welcome side effect:
In addition to the camcorder now being able to capture stereo audio, all audio recording apps that allow the microphone
to be changed to the "camcorder" microphone (provided the app itself offers stereo processing) can take advantage of this mod, too.
Apps that are capable of recording stereo audio with this mod are "Voice Recorder" and "Easy Voice Recorder Pro".
I have created a flashable zip for the mod for you guys! @op feel free to add link in the first post
https://www.androidfilehost.com/?fid=673368273298917236
So with Google Camera I can't record stereo audio?
I assume this disables surround sound/dual mono mod, since it's replacing same files?
axiel7 said:
So with Google Camera I can't record stereo audio?
Click to expand...
Click to collapse
previously you can't, but now with this mod you can record stereo audio. (or with any camera app)
resutatto said:
I assume this disables surround sound/dual mono mod, since it's replacing same files?
Click to expand...
Click to collapse
Most likely yes. i don't use surround sound mod so i don't know.
kraatus90 said:
previously you can't, but now with this mod you can record stereo audio. (or with any camera app)
Most likely yes. i don't use surround sound mod so i don't know.
Click to expand...
Click to collapse
What lines do you edit for stereo recording? Maybe we can make a surround mod with stereo recording
resutatto said:
I assume this disables surround sound/dual mono mod, since it's replacing same files?
Click to expand...
Click to collapse
No, it doesn't.
axiel7 said:
What lines do you edit for stereo recording? Maybe we can make a surround mod with stereo recording
Click to expand...
Click to collapse
in mixer_path-
add this -
Code:
<path name="camcorder-stereo-mic">
<ctl name="AIF1_CAP Mixer SLIM TX7" value="1"/>
<ctl name="AIF1_CAP Mixer SLIM TX8" value="1" />
<ctl name="SLIM_0_TX Channels" value="Two" />
<ctl name="SLIM TX7 MUX" value="DEC10" />
<ctl name="DEC10 MUX" value="DMIC3" />
<ctl name="SLIM TX8 MUX" value="DEC7" />
<ctl name="DEC7 MUX" value="DMIC1" />
<ctl name="DEC7 Volume" value="78" />
<ctl name="DEC10 Volume" value="78" />
</path>
and modify this -
Code:
<path name="camcorder-mic">
<path name="camcorder-handset-mic" />
</path>
into this -
Code:
<path name="camcorder-mic">
<path name="camcorder-stereo-mic" />
</path>
That's what i see changed compared to stock.
Flashable zip with stereo camcorder and surround combined into one.
Please test whether it works, because I replaced the files on my phone manually.
Some info: Google Camera records in stereo @48 kHz ~98 kbps.
Snap Camera is available to record @48 kHz 192 kbps.
Test It on 7.11 puer nexus, working good!! Thank you for work....
Thank you for sharing
przemcio510 said:
Flashable zip with stereo camcorder and surround combined into one.
Please test whether it works, because I replaced the files on my phone manually.
Some info: Google Camera records in stereo @48 kHz ~98 kbps.
Snap Camera is available to record @48 kHz 192 kbps.
Click to expand...
Click to collapse
So this is a flashable zip with surround sound mod and stereo audio recording mod?
I'm not sure if this mod is responsible but since I flashed it my girlfriend claims that my voice reception is terrible. I told her for the last time stop blaming my phone, and to get something to replace that crappy Galaxy S3 of hers.
For me, the first zip does not break surround sound.
Ryder. said:
So this is a flashable zip with surround sound mod and stereo audio recording mod?
Click to expand...
Click to collapse
Yes
leolawliet said:
I'm not sure if this mod is responsible but since I flashed it my girlfriend claims that my voice reception is terrible. I told her for the last time stop blaming my phone, and to get something to replace that crappy Galaxy S3 of hers.
Click to expand...
Click to collapse
You may try to disable noise cancelling on your side by changing persist.audio.fluence.voicecall to false in build.prop. If it doesn't help, then her phone might be the problem
doggie13_ said:
For me, the first zip does not break surround sound.
Click to expand...
Click to collapse
Flashing your zip didn't work for me, i had to manually copy both files to the system/etc folder.
Same with @przemcio510 combined zip file. I'm using the combined mod and both stereo recording and "surround" sound are working.
Stock_files.zip gives me a error och stock rooted mmf26f.
RoadToNever said:
Stock_files.zip gives me a error och stock rooted mmf26f.
Click to expand...
Click to collapse
Did you even read the OP?
kraatus90 said:
These are not flashable zips For flashable zip see post #2.
Click to expand...
Click to collapse
---------- Post added at 04:12 PM ---------- Previous post was at 03:35 PM ----------
I increased the bitrate for the recorded audio to 192kbps as 96kpbs is pretty low for stereo and made a flashable zip with both stereo recording and DualMonoV2 combined. I've also attached a flashable zip with the stock files.
Thanks to @Jose-MXL @chdloc and @kraatus90 for these mods.
Can you make a module for magisk with this mod (stereo mic + dual mono)? I don't know if is easy or complicated to achieve.
v1c70r said:
Can you make a module for magisk with this mod (stereo mic + dual mono)? I don't know if is easy or complicated to achieve.
Click to expand...
Click to collapse
Here's a zip for Magisk. I don't know if it works but I followed the template they have.

Categories

Resources