[Guide] AC3 sound for stock player & others - Galaxy Tab S General

How to add support for AC3 audio format​
Guide (need root):
1. Put the file media_codecs.xml in the folder system/etc
2. Put the files libsac3d.so & libsomxac3d.so in the folder system/lib
3. Set permissions to all 3 files: 0644 (owner: root/root)
4. Reboot
Thanks to: Pako777
Download:
View attachment AC3_Tab_S.rar

what is it ? ^^

androidrouen said:
what is it ? ^^
Click to expand...
Click to collapse
Stock player can not play the AC3 audio format (the video can be seen but there is no audio). With this trick the problem disappears..

Nice.

A word of caution
Set the permissions of all 3 files (and not only the last 2... ) to 0644, otherwise you end up with the software video mode...

Niice more reason for me to root this beauty..
Sent from my SM-T705 using Tapatalk

works great thanks

A few days ago I configured a Tab S 10.5 for a relative. They will not root so I installed the free version of MX Player and its ARM7 codec package. This gave me AC3 support without rooting and the loss of the warranty. I also configured MX Player to use HW+ acceleration for all playback.
If the tablet was mine I would have rooted within 10 minutes of confirming that all the hardware works, so I'm only mentioning this alternative for non-root users that want to play AC3 content. I personally bought MX Player Pro as the app is the best video player for Android as far as I'm concerned.
P.S. Thanks for this valuable post.
Sent from my Nexus 10 using XDA Premium HD app

3DSammy said:
I installed the free version of MX Player and its ARM7 codec package. This gave me AC3 support without rooting and the loss of the warranty.
Click to expand...
Click to collapse
Thanks.

Thank you very much.
Any reason why would samsung remove this libs when they are present in older note 3 phones ?

leojab said:
Thank you very much.
Any reason why would samsung remove this libs when they are present in older note 3 phones ?
Click to expand...
Click to collapse
Save money on licensing it for these series of tablets?

Is there a way to also get DTS?

Could anyone guide on how to play Ultra HD videos?
I am not able to play them either through MX with all custom codecs installed and not even through the built in video player with the additional libraries.

no sound on AVCHD.mts (has ac3 from Sony DSC-HX
MX Player with S/W or H/W+ Decoder plays it with Sound (not the H/W Decoder). I installed the files and corrected the permisssion, but still no sound with the preinstalled Video app. it says "no Audio ... not supported Audio codec"
here is the format info:
Code:
Vollständiger Name : \PRIVATE\AVCHD\BDMV\STREAM\00401.MTS
Format : BDAV
Format/Info : Blu-ray Video
Dateigröße : 89,1 MiB
Dauer : 28s 253ms
Modus der Gesamtbitrate : variabel
Gesamte Bitrate : 26,4 Mbps
maximale Gesamtbitrate : 28,0 Mbps
Audio
ID : 4352 (0x1100)
Menü-ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Format_Settings_ModeExtension : CM (complete main)
Format-Einstellungen für Endianess : Big
Codec-ID : 129
Dauer : 28s 320ms
Bitraten-Modus : konstant
Bitrate : 256 Kbps
Kanäle : 2 Kanäle
Kanal-Positionen : Front: L R
Samplingrate : 48,0 KHz
BitDepth/String : 16 bits
Stream-Größe : 885 KiB (1%)
Video
ID : 4113 (0x1011)
Menü-ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format-Profil : [email protected]
Format-Einstellungen für CABAC : Ja
Format-Einstellungen für ReFrames : 2 frames
Format_Settings_GOP : M=1, N=12
Codec-ID : 27
Dauer : 28s 320ms
Bitraten-Modus : variabel
Bitrate : 25,1 Mbps
maximale Bitrate : 26,0 Mbps
Breite : 1 920 Pixel
Höhe : 1 080 Pixel
Bildseitenverhältnis : 16:9
Bildwiederholungsrate : 50,000 FPS
ColorSpace : YUV
ChromaSubsampling : 4:2:0
BitDepth/String : 8 bits
Scantyp : progressiv
Bits/(Pixel*Frame) : 0.242
Stream-Größe : 84,8 MiB (95%)
Text
ID : 4608 (0x1200)
Menü-ID : 1 (0x1)
Format : PGS
Codec-ID : 144
Dauer : 27s 775ms
I also looked at the differences in the .XML:
Code:
<MediaCodec name="OMX.google.vpx.decoder" type="video/x-vnd.on2.vp8" />
instaed of
<MediaCodec name="OMX.google.vp8.decoder" type="video/x-vnd.on2.vp8" />
<MediaCodec name="OMX.google.vp9.decoder" type="video/x-vnd.on2.vp9" />
additional
Code:
<MediaCodec name="OMX.SEC.hevc.sw.dec" type="video/hevc" >
<Quirk name="decoder-ignores-streamcorrupt-error" />
</MediaCodec>
<MediaCodec name="OMX.Exynos.mpeg4.enc" type="video/mp4v-es" >
<Quirk name="requires-allocate-on-input-ports" />
<Quirk name="requires-allocate-on-output-ports" />
<Quirk name="video-controller-check-enable" />
</MediaCodec>
<MediaCodec name="OMX.Exynos.h263.enc" type="video/3gpp" >
<Quirk name="requires-allocate-on-input-ports" />
<Quirk name="requires-allocate-on-output-ports" />
<Quirk name="video-controller-check-enable" />
</MediaCodec>
<MediaCodec name="OMX.Exynos.avc.enc" type="video/avc" >
<Quirk name="requires-allocate-on-input-ports" />
<Quirk name="requires-allocate-on-output-ports" />
<Quirk name="video-controller-check-enable" />
</MediaCodec>

TheGoD said:
Is there a way to also get DTS?
Click to expand...
Click to collapse
MX Player allows you to install custom decoders. There is an XDA forum that publishes the DTS decoder file which you can add to MX Player. No root is required but sometimes when MX Player is updated you'll have to wait until the DTS decoder is also updated. That's not a big deal just something you'll need to I aware of. This is a licensing issue and a work around. A long time ago MX Player included DTS support with the player install.
Sent from my Nexus 10 using XDA Premium HD app

Thanks, I know about that. Would prefer to get a solution for the stock player though too.

TheGoD said:
Thanks, I know about that. Would prefer to get a solution for the stock player though too.
Click to expand...
Click to collapse
Could one of you please upload a media file (Video would be best) with AC3 that works for him ... so I can test

Why do you guys try XBMC?
Sent from my Galaxy Note 2

needs testing
Could one of you please upload a media file (Video would be best) with AC3 that works for him ... so I can test

I dont think its a good idea just to take the media_codecs.xml from here, as it has more changes than just AC3. I'd suggest to just add those lines to your original media_codecs.xml
Code:
<MediaCodec name="OMX.SEC.ac3.dec" type="audio/ac3" >
<Quirk name="needs-flush-before-disable" />
<Quirk name="decoder-ignores-streamcorrupt-error" />
</MediaCodec>
I m still not having AC-3 sound on my AVCHD.mts video files. Stock video player says unknown audio codec.

Related

[FIX] Voice messages

First of all, thank user @Bobgle for the fix. He killed the fish with that, so big kudos.
I just had to add a little line of code to the /system/etc/media_profiles.xml. I know it's not your rom which has the problem, I'll tell the other developer how to fix it as well. I first found out that it was a common problem through your NOPE Kernel FAQ, though, so it's definitely worth adding.
This is the line of code:
Code:
<AudioEncoderCap name="aac" enabled="true"
minBitRate="8000" maxBitRate="96000"
minSampleRate="8000" maxSampleRate="48000"
minChannels="1" maxChannels="1" />
Has to go right between these two and should look like this:
Code:
<VideoEncoderCap name="m4v" enabled="true"
minBitRate="64000" maxBitRate="8000000"
minFrameWidth="176" maxFrameWidth="1280"
minFrameHeight="144" maxFrameHeight="720"
minFrameRate="1" maxFrameRate="30" />
<AudioEncoderCap name="aac" enabled="true"
minBitRate="8000" maxBitRate="96000"
minSampleRate="8000" maxSampleRate="48000"
minChannels="1" maxChannels="1" />
<AudioEncoderCap name="amrnb" enabled="true"
minBitRate="5525" maxBitRate="12200"
minSampleRate="8000" maxSampleRate="8000"
minChannels="1" maxChannels="1" />
Once you've done that it's working. I also replaced this line in the media_codecs.xml:
Code:
<MediaCodec name="AACEncoder" type="audio/mp4a-latm" />
with:
Code:
<MediaCodec name="OMX.google.aac.encoder" type="audio/mp4a-latm" />
I'm not sure if that was necessary. Anyway, it's working.
Click to expand...
Click to collapse
I've put his message in the spoiler. I'll put it simply below, hopefully correctly.
-Open /system/etc/media_profiles.xml
-Find
Code:
<VideoEncoderCap name="m4v" enabled="true"
minBitRate="64000" maxBitRate="8000000"
minFrameWidth="176" maxFrameWidth="1280"
minFrameHeight="144" maxFrameHeight="720"
minFrameRate="1" maxFrameRate="30" />
-After that line of code squeeze in this:
Code:
<AudioEncoderCap name="aac" enabled="true"
minBitRate="8000" maxBitRate="96000"
minSampleRate="8000" maxSampleRate="48000"
minChannels="1" maxChannels="1" />
-Save and close
-Open: media_codecs.xml (Same folder.)
-Find:
Code:
<MediaCodec name="AACEncoder" type="audio/mp4a-latm" />
-Replace the line with:
Code:
<MediaCodec name="OMX.google.aac.encoder" type="audio/mp4a-latm" />
-Save, close reboot.
Post results, and stuff and hopefully he will be able to answer stuff. The issue was in the ROM itself apparently, so it should work for any CM10 based such.
Edit: Of course, since this is not thoroughly tested, make sure you do a backup before you edit anything.
Not helped.
Desire C,MiniCMv7,NOPE Kernel
Dark_AssassinUA said:
Not helped.
Desire C,MiniCMv7,NOPE Kernel
Click to expand...
Click to collapse
I'm using the CyanogenMod10 (Build #3 by cute_prince) so I guess that MiniCM uses different encoders and decoders. I'll take a look at it, the fix should be similar.
Edit: Okay, it seems to be completely the same. The encoder should be included and working, are you sure you've edited all the things you have to edit? I was just messing around so I don't know what exactly I've changed, it could be that I've forgotten something, I'll upload my files. I've taken these directly from my phone where voice messages are working flawlessly with WhatsApp and Facebook.
To test if your aac encoder is now working, you could try downloading a recorder which supports the filetype. I used Easy Voice Recorder. Make sure to select AAC.
The problem with voice messages was simply that most apps use aac files, most cm roms did have the codec, but it simply wasn't registered in the files.
Edit2: If it still doesn't work after pushing my files in the correct directory (/system/etc/) try clearing all the caches (dalvik cache, too). If it isn't working after you did that, I would guess that this fix only works for cute_prince's rom.
Bobgle said:
I'm using the CyanogenMod10 (Build #3 by cute_prince) so I guess that MiniCM uses different encoders and decoders. I'll take a look at it, the fix should be similar.
Edit: Okay, it seems to be completely the same. The encoder should be included and working, are you sure you've edited all the things you have to edit? I was just messing around so I don't know what exactly I've changed, it could be that I've forgotten something, I'll upload my files. I've taken these directly from my phone where voice messages are working flawlessly with WhatsApp and Facebook.
To test if your aac encoder is now working, you could try downloading a recorder which supports the filetype. I used Easy Voice Recorder. Make sure to select AAC.
The problem with voice messages was simply that most apps use aac files, most cm roms did have the codec, but it simply wasn't registered in the files.
Edit2: If it still doesn't work after pushing my files in the correct directory (/system/etc/) try clearing all the caches (dalvik cache, too). If it isn't working after you did that, I would guess that this fix only works for cute_prince's rom.
Click to expand...
Click to collapse
Wow,it`s working!
Huge thanks from Ukraine!
From newbies(like me) made flashable zip
Dark_AssassinUA said:
Wow,it`s working!
Huge thanks from Ukraine!
From newbies(like me) made flashable zip
Click to expand...
Click to collapse
Glad I could help.
wwooowwwww .....thnxx bro...really it worked....i always had to switch back to sense bcoz of voice message problem in watsapp n other such apps...u saved my life...

[Q] best for smart phone.

Suggest your best opinions these ...
Launcher :
Browser :
Security :
File explorer :
Text editor :
File transfer :
Audio player :
Video player :
Mine..
Launcher : Nova launcher prime
Browser : UC Browser
Security : CM security
File explorer : Es file explorer
Text editor : wps office editor
File transfer : super beam
Audio player : power amp
Video player : MX Player
Launcher : Nova Launcher
Browser : Uc Browser & Puffin
Security : Avast Mobile Security
File explorer :Es File Explorer
Text editor :Andro Open Office
File transfer : Es File Explorer
Audio player : Poweramp
Video player : Mx Player
Launcher :-trebuchet
Launcher : Nova Launcher Prime
Browser : Chrome Dev
Security : Android doen't need security
File explorer : ES File Explorer
Text editor : ES Note Editor (Inside ES File Explorer)
File transfer : Superbeam
Audio player : MusixMatch
Video player : MX Player
Launcher : smart launcher
Browser : opera or firefox
Security : smart brain
File explorer : root exprorer
Text editor : dont have favorite
File transfer : not really
Audio player : whatever ROM has i don't use any
Video player : MX Player
Launcher : Nova Launcher
Browser : Firefox
Security : I don't use any
File explorer : Es Explorer
Text editor : Es Explorer
File transfer : Es Explorer
Audio player : Jetaudio with Vampire MoD
Video player : Mx Player

CM12.1 Camera App

Can anyone port the CM12.1 Camera app. ( .apk or .zip file ).
Thanks
I wouldnt recommend that..
Instead Just use Google camera or Open Camera... (But your choice)
Too lazy... Just install the apk
(Dont know whether itll work or not. depending on which rom you're running on)
http://drive.google.com/file/d/0Bx8B-WYmLpHIY3ZlNm1uYXdQVkE/view
sagar846 said:
Instead Just use Google camera or Open Camera... (But your choice)
Too lazy... Just install the apk
(Dont know whether itll work or not. depending on which rom you're running on)
http://drive.google.com/file/d/0Bx8B-WYmLpHIY3ZlNm1uYXdQVkE/view
Click to expand...
Click to collapse
does it support slomo video recording at 60 fps and 120 fps ?
You can't shoot slowmotion with CM Roms , only stock .
Valentin4ou93 said:
You can't shoot slowmotion with CM Roms , only stock .
Click to expand...
Click to collapse
actually you can on moto g 2013/motox 2014. i got it working by messing with media_profiles.xml. i can try fixing it for moto g 2014 too, just give me the cm12.1 media_profiles.xml file from /system/etc/. but it will only work on moto camera app.
ask in question thread.
kraatus90 said:
actually you can on moto g 2013/motox 2014. i got it working by messing with media_profiles.xml. i can try fixing it for moto g 2014 too, just give me the cm12.1 media_profiles.xml file from /system/etc/. but it will only work on moto camera app.
Click to expand...
Click to collapse
Files are the same, just show me your modified falcon one and I might push it to CM if I confirm it working on my device.
LuK1337 said:
Files are the same, just show me your modified falcon one and I might push it to CM if I confirm it working on my device.
Click to expand...
Click to collapse
these are the additional lines needed for slowmo ( from motox2)
Code:
[COLOR="Red"]<!ATTLIST VideoEncoderCap maxHFRFrameWidth CDATA #REQUIRED>
<!ATTLIST VideoEncoderCap maxHFRFrameHeight CDATA #REQUIRED>
<!ATTLIST VideoEncoderCap maxHFRMode CDATA #REQUIRED>[/COLOR]
Code:
<VideoEncoderCap name="h264" enabled="true"
minBitRate="64000" maxBitRate="65000000"
minFrameWidth="176" maxFrameWidth="3840"
minFrameHeight="144" maxFrameHeight="2160"
minFrameRate="15" maxFrameRate="120"
[COLOR="Red"] maxHFRFrameWidth="1920" maxHFRFrameHeight="1080"
maxHFRMode="120" />
[/COLOR]
<VideoEncoderCap name="h263" enabled="true"
minBitRate="64000" maxBitRate="2000000"
minFrameWidth="176" maxFrameWidth="720"
minFrameHeight="144" maxFrameHeight="480"
minFrameRate="15" maxFrameRate="30"
[COLOR="red"]maxHFRFrameWidth="0" maxHFRFrameHeight="0"
maxHFRMode="0" />[/COLOR]
<VideoEncoderCap name="m4v" enabled="true"
minBitRate="64000" maxBitRate="65000000"
minFrameWidth="176" maxFrameWidth="1920"
minFrameHeight="144" maxFrameHeight="1080"
minFrameRate="15" maxFrameRate="60"
[COLOR="red"]maxHFRFrameWidth="1920" maxHFRFrameHeight="1080"
maxHFRMode="120" />[/COLOR]
slowmo will work with stock moto camera app, but there's a little problem. on stock firmware slowmo video is recorded at 120fps and runs at 15 fps (1/8 speed ) , and by this method it will record video at 120fps but it will run it at 30fps ( 1/4 speed ). atleast it's better than having nothing.
kraatus90 said:
these are the additional lines needed for slowmo ( from motox2)
Code:
[COLOR="Red"]<!ATTLIST VideoEncoderCap maxHFRFrameWidth CDATA #REQUIRED>
<!ATTLIST VideoEncoderCap maxHFRFrameHeight CDATA #REQUIRED>
<!ATTLIST VideoEncoderCap maxHFRMode CDATA #REQUIRED>[/COLOR]
Code:
<VideoEncoderCap name="h264" enabled="true"
minBitRate="64000" maxBitRate="65000000"
minFrameWidth="176" maxFrameWidth="3840"
minFrameHeight="144" maxFrameHeight="2160"
minFrameRate="15" maxFrameRate="120"
[COLOR="Red"] maxHFRFrameWidth="1920" maxHFRFrameHeight="1080"
maxHFRMode="120" />
[/COLOR]
<VideoEncoderCap name="h263" enabled="true"
minBitRate="64000" maxBitRate="2000000"
minFrameWidth="176" maxFrameWidth="720"
minFrameHeight="144" maxFrameHeight="480"
minFrameRate="15" maxFrameRate="30"
[COLOR="red"]maxHFRFrameWidth="0" maxHFRFrameHeight="0"
maxHFRMode="0" />[/COLOR]
<VideoEncoderCap name="m4v" enabled="true"
minBitRate="64000" maxBitRate="65000000"
minFrameWidth="176" maxFrameWidth="1920"
minFrameHeight="144" maxFrameHeight="1080"
minFrameRate="15" maxFrameRate="60"
[COLOR="red"]maxHFRFrameWidth="1920" maxHFRFrameHeight="1080"
maxHFRMode="120" />[/COLOR]
slowmo will work with stock moto camera app, but there's a little problem. on stock firmware slowmo video is recorded at 120fps and runs at 15 fps (1/8 speed ) , and by this method it will record video at 120fps but it will run it at 30fps ( 1/4 speed ). atleast it's better than having nothing.
Click to expand...
Click to collapse
Kk it actually does work, thank you for contributing to CM lol.
LuK1337 said:
Kk it actually does work, thank you for contributing to CM lol.
Click to expand...
Click to collapse
thanks , i was kinda surprised when i got it working considering im a noob.
Please upload the file.
kraatus90 said:
thanks , i was kinda surprised when i got it working considering im a noob.
Click to expand...
Click to collapse
Please @LuK1337 or @kraatus90 upload the modified file.
Does this enable HDR mode as well?
tbiwalkar said:
Please @LuK1337 or @kraatus90 upload the modified file.
Does this enable HDR mode as well?
Click to expand...
Click to collapse
don't have modified file for this device, give me original so i can modify it, or just add those red lines by yourself.
HDR in videos or photos ? if you are asking about videos then no.
Photos.
---------- Post added 28-10-2015 at 12:03 AM ---------- Previous post was 27-10-2015 at 11:43 PM ----------
kraatus90 said:
don't have modified file for this device, give me original so i can modify it, or just add those red lines by yourself.
HDR in videos or photos ? if you are asking about videos then no.
Click to expand...
Click to collapse
https://drive.google.com/file/d/0B-j7fkMgO998U21PMGh5RWZWeDA/view?usp=docslist_api
tbiwalkar said:
Photos.
---------- Post added 28-10-2015 at 12:03 AM ---------- Previous post was 27-10-2015 at 11:43 PM ----------
https://drive.google.com/file/d/0B-j7fkMgO998U21PMGh5RWZWeDA/view?usp=docslist_api
Click to expand...
Click to collapse
don't flash it,just extract and replace. enjoy
lel i changed media_profiles.xml and now it only records in 288p 15 fps and i cant switch front camera xD
kraatus90 said:
don't flash it,just extract and replace. enjoy
Click to expand...
Click to collapse
Thanks a lot! slow motion is working fine . also Camera can click pictures in HDR. only thing left is cropping slowmo videos like in stock based roms. thanks a ton @kraatus90

Incall Volume fix + Crystal clear audio recording mod v3.0

Helllo , friends I am developed this mod for users who love recording .....!
Steps to install this mod :
TWRP and Other recovery
then install this from recovery
reboot system and enjoy clear crystal clear recording.
Features of this mod :
Incall volume fixed.
Noiseless recording.
also working same for nougat and oreo roms only files is different....!
Downloads:
Nougat:
https://www.androidfilehost.com/?fid=746010030569959423
Oreo:
https://www.androidfilehost.com/?fid=962187416754465960
Your mod gave me static sound in recording.
Sushant9096 said:
Hello welcome all of you , I am developed this mod of crystal clear audio recording for users who loved recording and use starmaker and another applications like this.....
Let's enjoy my mod ......
Must remember your device is unlocked for install this mod...!
Steps to install this mod :
TWRP and Other recovery
then install this from recovery
reboot system and enjoy clear crystal clear recording.
Downloads :
Crystal clear recording mod v1.0:
How To Download :
1 . Search redmi 4x androidfilehost on google
2 . Go to Redmi 4x downloads
3 . find my name sushant9096
4 . go to sushant9096 files
5 . go to crystal clear recording mod
6 . then download file in this folder
Click to expand...
Click to collapse
Instead if this long process just give link of your file here,
Can't find
Het OP, why not save a lot of typing and post direct link?
https://androidfilehost.com/?w=files&flid=252043
Looks like you changed the ACDB id for mic to 2 (default is 4, other mods use 1)
Can you explain? Is this for Nougat and Oreo?
Cheers
I am unable to post links because I am new user in xda so my account not have allowed to post external link
...thank you @tweakradje
@Sushant9096 Ah I see. You're welcome.
@Sushant9096
I have looked at the new files. Can you tell me where you get all the ACDB profile id's from? From audio.primary.msm8937.so? The acdb profiles databases cannot be read without Qualcomm tools. (/etc/acdbdata/*acdb)
I don't think it is very useful to override every device's acdb id in audio_platform_info.xml
in the <acdb_id> section.
In this case you want other acdb profile for recording in stereo?
<device name="SND_DEVICE_IN_HANDSET_STEREO_DMIC" acdb_id="21"/>
Other acdb sound profiles to try: (assuming that are defaults from your audio config file)
SND_DEVICE_IN_MAIN_MIC acdb_id="4"
SND_DEVICE_IN_TOP_MIC acdb_id="11"
SND_DEVICE_IN_FRONT_MIC acdb_id="11"
SND_DEVICE_IN_HANDSET_DMIC_MUSIC acdb_id="21" <--- I took this profile
SND_DEVICE_IN_HANDSET_DMIC_VOICE acdb_id="533"
SND_DEVICE_IN_HANDSET_DMIC_INTERVIEW acdb_id="1045"
SND_DEVICE_IN_HANDSET_DMIC_HD acdb_id="2581" <--- Interesting profile
If your mappings are correct and represent the default profiles id's in your audio_platform_info.xml then acdb id 21 is the audio profile for SND_DEVICE_IN_HANDSET_DMIC_MUSIC
Of course you need to disable Fluence for audio recording too with this line in build.prop
persist.audio.fluence.audiorec=false
Please tell more about how you get this so we can learn.
Cheers
tweakradje said:
@Sushant9096
I have looked at the new files. Can you tell me where you get all the ACDB profile id's from? From audio.primary.msm8937.so? The acdb profiles databases cannot be read without Qualcomm tools. (/etc/acdbdata/*acdb)
I don't think it is very useful to override every device's acdb id in audio_platform_info.xml
in the <acdb_id> section.
In this case you want other acdb profile for recording in stereo?
<device name="SND_DEVICE_IN_HANDSET_STEREO_DMIC" acdb_id="21"/>
Other acdb sound profiles to try: (assuming that are defaults from your audio config file)
SND_DEVICE_IN_MAIN_MIC acdb_id="4"
SND_DEVICE_IN_TOP_MIC acdb_id="11"
SND_DEVICE_IN_FRONT_MIC acdb_id="11"
SND_DEVICE_IN_HANDSET_DMIC_MUSIC acdb_id="21" <--- I took this profile
SND_DEVICE_IN_HANDSET_DMIC_VOICE acdb_id="533"
SND_DEVICE_IN_HANDSET_DMIC_INTERVIEW acdb_id="1045"
SND_DEVICE_IN_HANDSET_DMIC_HD acdb_id="2581" <--- Interesting profile
If your mappings are correct and represent the default profiles id's in your audio_platform_info.xml then acdb id 21 is the audio profile for SND_DEVICE_IN_HANDSET_DMIC_MUSIC
Of course you need to disable Fluence for audio recording too with this line in build.prop
persist.audio.fluence.audiorec=false
Please tell more about how you get this so we can learn.
Cheers
Click to expand...
Click to collapse
@tweakradje
Fluence is needed for noiseless audio recording , Check my mod by recording something you like and see clarity and then give me feedback.
Fluence is already disabled..in build.prop
Sushant9096 said:
@tweakradje
Fluence is needed for noiseless audio recording , Check my mod by recording something you like and see clarity and then give me feedback.
Fluence is already disabled..in build.prop
Click to expand...
Click to collapse
I am looking into it.
Can you answer this: Can you tell me where you get all the ACDB profile id's from?
Thanks
tweakradje said:
I am looking into it.
Can you answer this: Can you tell me where you get all the ACDB profile id's from?
Thanks
Click to expand...
Click to collapse
@tweakradje
Join Qualcomm Developer Network and another devices source code of Xiaomi devices like redmi 4x to know more acdb_id profiles
Your Welcome....!
@Sushant9096 Thanks for the info!
tweakradje said:
@Sushant9096 Thanks for the info!
Click to expand...
Click to collapse
@tweakradje
Your Welcome....!
speaker stopped working! How to uninstall it??
sayansadhukhan62 said:
speaker stopped working! How to uninstall it?
Click to expand...
Click to collapse
If you are using pure kernel then its not my mod issue my mod isnt supported for this kernel so change your kernel to lh or stock kernel ....!
Let me share my findings to get perfect calibrated stereo professional sound recording for Redmi 4X Nougat.
in /etc/audio_platform_info.xml only add one override line in the acdb_ids section:
Code:
<!-- dual mic for video and audio recording (def 34), override with SND_DEVICE_IN_HANDSET_DMIC_MUSIC acdb_id 21 -->
<!-- with acdb id 4 set "DEC1/2 Volume" max to 94, else use 104 -->
<device name="SND_DEVICE_IN_HANDSET_STEREO_DMIC" acdb_id="21"/>
in /etc/mixer_paths_qrd_sku1.xml increase default recording volume. Make sure there is no extra "DEC1 Volume" lines in handset-stereo-dmic-ef or speaker-dmic-endfire path. (presuming you are not using broadside)
Code:
<!-- tweakradje increase default recording level from 84, if acdb id is 4 then max 94
<ctl name="DEC1 Volume" value="84" />
<ctl name="DEC2 Volume" value="84" /> -->
<ctl name="DEC1 Volume" value="104" />
<ctl name="DEC2 Volume" value="104" />
You can override the recording level anytime with for example:
Code:
adb shell su -c tinymix 'DEC1 Volume' 114
adb shell su -c tinymix 'DEC2 Volume' 114
Someone should build an mixer app for setting recording levels.
You can increase volume levels at any time with this for example:
Code:
adb shell su -c tinymix 'RX1 Digital Volume' 92
adb shell su -c tinymix 'RX2 Digital Volume' 92
adb shell su -c tinymix 'RX3 Digital Volume' 92
That is it. Please try and let us know.
tweakradje said:
Let me share my findings to get perfect calibrated stereo professional sound recording for Redmi 4X Nougat.
in /etc/audio_platform_info.xml only add one override line in the acdb_ids section:
Code:
<!-- dual mic for video and audio recording (def 34), override with SND_DEVICE_IN_HANDSET_DMIC_MUSIC acdb_id 21 -->
<!-- with acdb id 4 set "DEC1/2 Volume" max to 94, else use 104 -->
<device name="SND_DEVICE_IN_HANDSET_STEREO_DMIC" acdb_id="21"/>
in /etc/mixer_paths_qrd_sku1.xml increase default recording volume. Make sure there is no extra "DEC1 Volume" lines in handset-stereo-dmic-ef or speaker-dmic-endfire path. (presuming you are not using broadside)
Code:
<!-- tweakradje increase default recording level from 84, if acdb id is 4 then max 94
<ctl name="DEC1 Volume" value="84" />
<ctl name="DEC2 Volume" value="84" /> -->
<ctl name="DEC1 Volume" value="104" />
<ctl name="DEC2 Volume" value="104" />
You can override the recording level anytime with for example:
Code:
adb shell su -c tinymix 'DEC1 Volume' 114
adb shell su -c tinymix 'DEC2 Volume' 114
Someone should build an mixer app for setting recording levels.
You can increase volume levels at any time with this for example:
Code:
adb shell su -c tinymix 'RX1 Digital Volume' 92
adb shell su -c tinymix 'RX2 Digital Volume' 92
adb shell su -c tinymix 'RX3 Digital Volume' 92
That is it. Please try and let us know.
Click to expand...
Click to collapse
Thank you for this useful info I will try this In next version of my mod...
I'm currently using "Sound Fix v1" by thejayyadav (Magisk module)
Which is the main difference with yours? ?
Do this mod affect smule app ? Or other karaoke app? I means "noiseless"
Hey @Sushant9096, is this mod compitible for other devices like redmi 3s

[WIP!][KERNEL] Razer Phone 2 Kernel (+exfat module, TWRP device tree, and more!)

Hi all!
What is this?
This is my mostly-working Razer Phone 2 Kernel and TWRP device tree!
I've been reading threads where people are having issues compiling the Razer-provided source for the RP2 and figured I should post what I have so others can use it to help achieve a fully working source-built kernel.
I'm also including a set of scripts to repack a Magisk-patched boot.img so you can iterate on building a new kernel rapidly, and am including a prebuilt magisk-patched boot.img with the custom kernel so we can QA other features while focusing on the known-broken things.
Also also, I'm including an exfat kernel module (not built into kernel for now) so that can be tested too!
Click to expand...
Click to collapse
Why is this mostly-working?
I've tested many features on this kernel and so far the only feature *not* working is the microphone. (Audio recording, haven't tested in-call audio)
This kernel is a mashup of Razer's source and a few other OSS repos from CAF - specifically the TFA98XX driver, and the audio-kernel repositories, so there's a bit of integration left to do to get all the audio features working.
I also had to edit the defconfig to get the DTB to build, and have to build with some special flags to use the prebuilt DTB compiler (dtc) since the one included in the source isn't capable of compiling the FIH DTBs inside the Razer-provided source (correct me if I'm doing something wrong here, but this was how I ended up getting it to work).
The kernel parameter skip_initramfs has also been renamed to skip__initramfs to break the silly bootloader skipping the ramdisk (and thereby breaking Magisk). This means you don't need to run Magisk's binary patch to rename that kernel argument to make Magisk or TWRP work.
Keep in mind, though, that this means if you use this kernel with a 100% stock ramdisk, you'll only ever get recovery since new Android ramdisks only contain recovery! (Thanks Dees_Troy for the refresher course!)
If you're familiar with the new audio-kernel CAF stuff, please let me know! I could use your assistance getting the microphone working.
It seems like the microphone isn't working because of some mismatches between the in-kernel msm audio drivers and the Razer customized drivers in the vendor partition.
I get errors like
Code:
[31269.485217] send_afe_cal_type cal_block not found!!
in dmesg when attempting to record audio. This seems isolated to the q6afe drivers in the kernel (specifically here: https://github.com/thecubed/android_kernel_razer_sdm845/blob/master/techpack/audio/dsp/q6afe.c#L1593 ) not playing nice with the prebuilt snd_soc_sdm845 kernel module.
Click to expand...
Click to collapse
Where do I get this?
See here for the TWRP device tree (and detailed instructions on how to set up your build tree): https://github.com/thecubed/android_device_razer_cheryl2
See here for just the kernel source: https://github.com/thecubed/android_kernel_razer_sdm845
See here for a kernel-less boot.img skeleton that you can drop your newly minted kernel into and repack with mkbootimg: http://downloads.codefi.re/thecubed/aura2/kernel/magisk_custom_kernel_skel.tar.gz
See here for a prebuilt boot.img with this custom kernel which includes Magisk: http://downloads.codefi.re/thecubed/aura2/kernel/boot_magisk_custom_9.img
See here for an exfat module you can insmod from a booted phone with custom kernel to try mounting exfat SD cards: http://downloads.codefi.re/thecubed/aura2/kernel/exfat_module.tar.gz
See here for a stock Magisk-patched boot.img for when you're done playing with this: http://downloads.codefi.re/thecubed/aura2/kernel/boot_magisk.img
Click to expand...
Click to collapse
How do I use this?
First off, this isn't for the average user. This kernel is *under development* and is not fully working yet. This means don't try this kernel on your mom's phone, your neighbor's phone, or any device that you aren't comfortable developing for.
Secondly, to test this, you'll need to be oem unlocked. There's plenty of guides to do this, but be aware that it erases all data on your phone when doing so. You could try using adb backup first, but I didn't have much success with that.
I'd suggest looking at the first link in the Where do I get this section and reading the README for the device tree as it'll have the most detailed instructions.
The gist is you'll need to download a minimal OmniROM manifest, add some lines to a file in .repo/local_manifests/cheryl2.xml, and run mka kernel to get a kernel image.
After that, you'll want to use mkbootimg to build a bootable magisk-patched boot.img, which you'll flash to your device with fastboot flash boot_X path/to/boot.img (where X is the active boot partition).
Once you've got the Image.gz-dtb file from your $OUT/obj/KERNEL_OBJ/arch/arm64/boot/Image.gz-dtb you'll want to repack it into a magisk-patched boot.img
Repacking the boot.img can be done with this command:
Code:
mkbootimg \
--kernel Image.gz-dtb \
--ramdisk boot_magisk.img-ramdisk.gz \
--cmdline 'console=ttyMSM0,115200n8 earlycon=msm_geni_serial,0xA84000 androidboot.hardware=qcom androidboot.console=ttyMSM0 video=vfb:640x400,bpp=32,memsize=3072000 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 service_locator.enable=1 swiotlb=2048 androidboot.configfs=true androidboot.usbcontroller=a600000.dwc3 buildvariant=user' \
--base 0x00000000 \
--pagesize 4096 \
--kernel_offset 0x00008000 \
--ramdisk_offset 0x01000000 \
--second_offset 0x00f00000 \
--tags_offset 0x00000100 \
--os_version 8.1.0 \
--os_patch_level 2018-10 \
-o ../boot_magisk_custom.img
Click to expand...
Click to collapse
FAQ
Does this have TWRP?
No. This does not have TWRP. The device tree is for TWRP eventually, and to make compiling the kernel easier (since Android kernels don't like compiling outside of Android's makefile system anymore)​
Does this have Magisk?
Yes! It's "pre-patched" too, as long as you're using my prebuilt one above.​
Do I need the custom kernel to use the exfat module?
Yes. This is because the Razer stock kernel has module signing forced. I don't have Razer's kernel module signing key so I can't compile kernel modules for the stock kernel. My kernel has module signing set to allow mismatched signatures, so both the Razer modules in /vendor/lib/modules (required for sound) and my exfat module can coexist.​
Why is exfat not compiled into the kernel?
Laziness, primarily. Actually, in this case I just didn't want to add extra variables to testing the kernel. If adding exfat into the kernel directly causes other issues it could potentially derail my quest to get this kernel up to par with the stock kernel.​
Why did other kernels not boot?
Most likely due to incompatible audio-kernel revisions, or dtb issues. I'm not sure, but getting this kernel to compile required a bit more hacking than it should have.​
Are you working on TWRP for Razer Phone 2?
Yep. Look for another post once the kernel is good to go. I aim to get encryption support working too, unless Dees_Troy beats me to it ​
Is audio still not working?
I'll update the post to remove the WIP tag and the section about audio as soon as it's working.​
Is anything else not working?
Feel free to download and test to let me know what else isn't working and I'll add it to the OP.​
Click to expand...
Click to collapse
Acknowledgements
Special thanks to Rashed97 and Dees_Troy for all their help.
Click to expand...
Click to collapse
y u quote OP?
Thanks for your work! Looking forward for a stable version. Wanna help but RP2 is currently my only working phone..
u sir,deserve a beer,thanks for working rp2 and not to forget other devs who help u along the way,we will wait patiently,cheers!!!!
Thank you.
Interesting discovery just now, seems that the stock kernel gives the same 'error' in dmesg when recording audio (but obviously audio recording still works).
Code:
[ 1365.950315] send_afe_cal_type cal_block not found!!
This could mean that Razer doesn't have a calibration profile for the microphone anyway (interesting, wonder if there's an opportunity to improve recording quality here?) and that I'm barking up the wrong tree re: calibration mismatches.
I've also confirmed that I get the same 'ASoC: no backend DAIs enabled for [backend name here]' messages in the stock kernel when brute force trying all PCM inputs with:
Code:
for f in `seq 1 80`; do tinycap /sdcard/wavs/device-$f.wav -D 0 -d $f -r 48000; done
It's also (very) possible that I don't understand how tinycap works.
I dumped the list of PCM inputs/outputs with:
Code:
for f in `ls -d /proc/asound/sdm845tavilsndc/** | grep pcm`; do echo "$f : `grep 'id' $f/info`"; done
and
Code:
cat /proc/asound/pcm
on both kernels (stock and custom) and they seem to match.
I'm thinking I should figure out how to record sound outside of android (from adb only) from stock kernel, and use that same test to try in the custom kernel. If I can find a test like that, I should be able to determine if I need to rename one of my DAI links to match whatever's baked into the XML files in /vendor/etc .
Any ideas?
Are you using the audio.a2dp.default.so driver?
Warrior1988: A2DP isn't in play here, and I'm using the stock /system and /vendor partitions, so any razer-customized tweaks are still present.
Currently, I've been working on figuring out the codec mappings to make sure that when audio is being recorded in the custom kernel that all the appropriate routing is set to enable audio from the tfa98xx chip (NXP amplifier, apparently supports digital microphones too?) or the wcd934x codec.
I'm not sure where the microphones are physically connected internally, so I'm working backwards from what gets enabled/disabled when recording audio in the stock kernel.
So far I have observed a few things (pardon my potentially incorrect terminology, the whole linux ASOC sound layer is new to me):
1. Audio in the stock and custom kernels is being captured by the mixer device called "SDM845 Media1", and it is capturing from SLIMBUS_0_TX input.
Code:
[Recording]
aura:/sys/module # cat /sys/kernel/debug/asoc/sdm845-tavil-snd-card/SDM845\ Media1/state
[SDM845 Media1 - Playback]
State: new
Backends:
No active DSP links
[SDM845 Media1 - Capture]
State: start
Hardware Params: Format = S16_LE, Channels = 1, Rate = 16000
Backends:
- SLIMBUS_0_TX
State: start
Hardware Params: Format = S16_LE, Channels = 1, Rate = 48000
2. You can also see when recording and not recording that in both kernels the SLIMBUS_0_TX input is wired correctly to the right mixer:
Code:
[Not recording]
aura:/sys # cat ./kernel/debug/asoc/sdm845-tavil-snd-card/platform:soc:qcom,msm-pcm-routing/dapm/SLIMBUS_0_TX
SLIMBUS_0_TX: Off in 2 out 0 - R0(0x0) mask 0x1
stream Slimbus Capture inactive
out "static" "SLIM0_UL_HL"
in "static" "Slimbus Capture"
in "static" "BE_IN"
[Recording]
aura:/sys # cat ./kernel/debug/asoc/sdm845-tavil-snd-card/platform:soc:qcom,msm-pcm-routing/dapm/SLIMBUS_0_TX
SLIMBUS_0_TX: On in 2 out 1 - R0(0x0) mask 0x1
stream Slimbus Capture inactive
out "static" "SLIM0_UL_HL"
out "SLIM_0_TX" "MultiMedia1 Mixer"
in "static" "Slimbus Capture"
in "static" "BE_IN"
Now that I've observed those things, I need to do a bit more research on how audio can get enabled/disabled on each of the chips that touch it.
For instance, in the custom kernel, I noticed that during recording sounds the DMIC* lines on the second tfa98xx aren't enabled. I haven't checked in the stock kernel yet - but if the tfa98xx chip is providing mic bias, it's possible that everything is wired right for input but since the mic bias isn't on, the mic isn't powered and thus we get no sound.
(Updated side note, why is Razer Phone 2 is using two TFA9888 chips? The tfa98xx.cnt firmware references TFA9892 which is mono only, too. I need to see a disassembly to figure out what chips it's actually using...)
Code:
aura:/sys # cat ./kernel/debug/asoc/sdm845-tavil-snd-card/codec:tfa98xx.4-0034/dapm/DMIC*
DMIC1: Off in 1 out 0
out "static" "AIF OUT"
DMIC2: Off in 1 out 0
out "static" "AIF OUT"
DMIC3: Off in 1 out 0
out "static" "AIF OUT"
DMIC4: Off in 1 out 0
out "static" "AIF OUT"
aura:/sys # cat ./kernel/debug/asoc/sdm845-tavil-snd-card/codec:tfa98xx.4-0035/dapm/DMIC*
DMIC1: Off in 1 out 0
out "static" "AIF OUT"
in "static" "MIC BIAS1"
DMIC2: Off in 1 out 0
out "static" "AIF OUT"
DMIC3: Off in 1 out 0
out "static" "AIF OUT"
in "static" "MIC BIAS3"
DMIC4: Off in 1 out 0
out "static" "AIF OUT"
Update: just noticed that this path doesn't exist on stock kernel. So the TFA driver I have doesn't match the one Razer is using. Interesting!
Also, I'm not sure why SLIMBUS_2 playback/capture aren't shown as 'dynamic DAI' linked (the '(*)' means it's a dynamic DAI)... Probably not important though.
Code:
aura:/proc/asound # cat pcm
00-00: MultiMedia1 (*) : : playback 1 : capture 1
00-01: MultiMedia2 (*) : : playback 1 : capture 1
00-02: VoiceMMode1 (*) : : playback 1 : capture 1
00-03: VoIP (*) : : playback 1 : capture 1
00-04: MultiMedia3 (*) : : playback 1
00-05: SLIMBUS_0 Hostless (*) : : playback 1 : capture 1
00-06: AFE-PROXY RX msm-stub-rx-6 : : playback 1
00-07: AFE-PROXY TX msm-stub-tx-7 : : capture 1
00-09: AUXPCM Hostless (*) : : playback 1 : capture 1
00-10: SLIMBUS_1 Hostless (*) : : playback 1 : capture 1
00-11: SLIMBUS_3 Hostless (*) : : playback 1 : capture 1
00-12: SLIMBUS_4 Hostless (*) : : playback 1 : capture 1
00-13: MultiMedia5 (*) : : playback 1 : capture 1
00-14: Listen 1 Audio Service (*) : : capture 1
00-16: MultiMedia10 (*) : : playback 1 : capture 1
00-17: MM_NOIRQ (*) : : playback 1 : capture 1
00-18: HDMI_RX_HOSTLESS (*) : : playback 1
00-19: VoiceMMode2 (*) : : playback 1 : capture 1
00-20: Listen 2 Audio Service (*) : : capture 1
00-21: Listen 3 Audio Service (*) : : capture 1
00-22: Listen 4 Audio Service (*) : : capture 1
00-23: Listen 5 Audio Service (*) : : capture 1
00-24: Listen 6 Audio Service (*) : : capture 1
00-25: Listen 7 Audio Service (*) : : capture 1
00-26: Listen 8 Audio Service (*) : : capture 1
00-27: MultiMedia9 (*) : : playback 1 : capture 1
00-33: MM_NOIRQ_2 (*) : : playback 1 : capture 1
00-34: SLIMBUS8_HOSTLESS Capture (*) : : capture 1
00-35: Slimbus4 Capture tavil_vifeedback-35 : : capture 1
00-36: SLIMBUS_2 Hostless Playback tavil_rx2-36 : : playback 1
00-37: SLIMBUS_2 Hostless Capture tavil_tx2-37 : : capture 1
00-38: MultiMedia6 (*) : : playback 1 : capture 1
00-39: USB Audio Hostless (*) : : playback 1 : capture 1
00-80: QUAT_MI2S_RX Hostless (*) : : playback 1
Meanwhile, we've reached out to Razer to see if they'll bless us with the full and complete kernel source this time
I doubt it. They won't even answer simple questions as to an estimate of when we're getting Pie
blackknightavalon said:
I doubt it. They won't even answer simple questions as to an estimate of when we're getting Pie
Click to expand...
Click to collapse
>simple question
>eta
pick one
Any progress on this kernel? I'm really curious now that we have pie.
No progress as of yet, I've been busy with work recently and Razer hasn't dropped source for the new kernel version (still 4.9 but a different patch level).
I'm hopeful that Razer will drop the complete source for Pie's kernel and I can backport that to the Oreo kernel for those who want to keep the old OS.
I haven't updated my RP2 to Pie yet so I can test out any changes once the source for the new kernel is out. I'll be sure to post here when I have any updates
Audio-kernel source is out! https://s3.amazonaws.com/cheryl-factory-images/audio-kernel-aura-2009.tar.gz
I'll be rebuilding my kernel very soon and testing.
https://s3.amazonaws.com/cheryl-factory-images/
Warrior1988 said:
https://s3.amazonaws.com/cheryl-factory-images/
Click to expand...
Click to collapse
Yup, I'm building it right now!
Yup, it works! I have fully working audio and microphone now. Seems like there's a bunch of DAI changes and some offset changes to calibration stuff that FIH added (ugh).
Please hold while I get the commit up on my Github, and I'll get a build with exfat going here in just a minute after.
Plan is:
- Github updates (readme changes, etc) UPDATE: done
- Upload this current build I just tested for anyone that wants it
- Add exfat module to kernel and rebuild / test UPDATE: exfat support works, BUT I need to recompile vold to support exfat. I can mount the SD card just fine, but Android doesn't understand that it's mounted because vold isn't tracking it
Also, <3 u razer, thanks
I'm bummed to hear about the layoffs, and I really appreciate whomever uploaded the source even after that. Hopefully Razer's phone team will grow again and get to make us a Razer Phone 3 at some point in the future.
For anyone that's still running 8.1 and wants to try my custom kernel (no, no exfat support yet until I get vold fixed), here's a link: http://downloads.codefi.re/thecubed/aura2/kernel/boot_magisk_custom_10.img
Github has been updated as well.
I'll be sure to update the OP tomorrow when it's not 2AM.
EDIT: Fixed link, 2AM is not kind to my typing skills
Awesome work! Very excited to try it out tomorrow.
Also sad to see your post about their layoffs. Pretty fun phone with much potential for future.
I think some of the reviews are pretty harsh given the penchant of Pixel / Samsung / Apple worship out there.
Anyway, thanks so much for this.
thecubed said:
For anyone that's still running 8.1 and wants to try my custom kernel (no, no exfat support yet until I get vold fixed), here's a link: http://downloads.codefi.re/thecubed/aura2/boot_magisk_custom_10.img
Github has been updated as well.
I'll be sure to update the OP tomorrow when it's not 2AM.
Click to expand...
Click to collapse
Thank you for this!
It's showing up "Not found" on the download link though.
jal3223 said:
Thank you for this!
It's showing up "Not found" on the download link though.
Click to expand...
Click to collapse
Fixed the link in my previous post - sorry about that!
I'll be updating the OP tonight too when I get home from work.
Looking good! Is the sound as good as stock (or maybe better, considering the low volume crackling we get)?
Hoping to give this a shot soon, as soon as I figure out rooting on 9.0. I saw a thread about it, but nobody answered my question there, and light digging through threads didn't turn up an answer, so trying this kernel will have to wait a bit. Makes me miss the HTC root days, when finding out about root was a simple yes or no situation... lol.

Categories

Resources