Modification and improvement of sound quality | 4.0+



Rep: (282)
Modification and improvement of sound quality android | Modification and improvement of sound quality android

This topic is created to improve and enhance sound characteristics androyd devices
where everything is described in detail from simple actions build.prop,
ending with the introduction of third-party audio library into your smartphone.

I will update the topic in the course of time

For all actions, you will need to have root rights
Setting audio_policy
List samplingRates 8000,16000,32000,44100,48000,88200,96000,176400,192000,384000,768000
Listformatas ascending
AUDIO_FORMAT_PCM_16_BIT
AUDIO_FORMAT_PCM_24_BIT_PACKED (mainly used for a2dp profile)
AUDIO_FORMAT_PCM_8_24_BIT
AUDIO_FORMAT_PCM_32_BIT

fast flag
He sound output low-delay 40 ms
<mixPort name = "lowlatency out" role = "source" flags = "AUDIO_OUTPUT_FLAG_FAST">
<profile name = "" format = "AUDIO_FORMAT_PCM_16_BIT"
samplingRates = "48000"
channelMasks = "AUDIO_CHANNEL_OUT_STEREO" />
</ mixPort>

16 bit 48Khz and maksimklno and everything below. It is impossible to deduce hires

Unloading offload
List formats:
AUDIO_OUTPUT_FLAG_DIRECT (direct access)
AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD (compression of the audio output)
AUDIO_OUTPUT_FLAG_NON_BLOCKING (audio output is not blocked)

is used to display the bluetooth device or where appropriate headset, modern devices to compress the signal under mp3 SBC codec if headphones (device) do not support the codec ldac, aptx and hwa
if it is possible to deduce hires through codec, the output goes through 24_BIT_PACKED, simplified format 24bit

<mixPort name = "offload" role = "source" flags = "AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD | AUDIO_OUTPUT_FLAG_NON_BLOCKING">
<profile name = "" format = "AUDIO_FORMAT_MP3"
samplingRates = "8000,11025,12000,16000,22050,24000,32000,44100,48000"
channelMasks = "AUDIO_CHANNEL_OUT_STEREO" />
<profile name = "" format = "AUDIO_FORMAT_PCM_24_BIT_PACKED"
samplingRates = "48000"
channelMasks = "AUDIO_CHANNEL_OUT_STEREO" />
</ mixPort>


Direct output to the sound system to ignore all effects and post treatments, that is the conclusion HIRES
List formats:
AUDIO_OUTPUT_FLAG_DIRECT (direct access)
AUDIO_OUTPUT_FLAG_DIRECT_PCM (direct access to the PCM container)
What's the difference Do not know, you can use 1 of them

<mixPort name = "direct_pcm" role = "source" flags = "AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_DIRECT_PCM | AUDIO_OUTPUT_FLAG_VOIP_RX">
<profile name = "" format = "AUDIO_FORMAT_PCM_16_BIT"
samplingRates = "8000,16000,32000,44100,48000,88200,96000,176400,192000,384000"
channelMasks = "AUDIO_CHANNEL_OUT_MONO, AUDIO_CHANNEL_OUT_STEREO" />
<profile name = "" format = "AUDIO_FORMAT_PCM_8_24_BIT"
samplingRates = "8000,16000,32000,44100,48000,88200,96000,176400,192000,384000"
channelMasks = "AUDIO_CHANNEL_OUT_MONO, AUDIO_CHANNEL_OUT_STEREO" />
<profile name = "" format = "AUDIO_FORMAT_PCM_32_BIT"
samplingRates = "8000,16000,32000,44100,48000,88200,96000,176400,192000,384000"
channelMasks = "AUDIO_CHANNEL_OUT_MONO, AUDIO_CHANNEL_OUT_STEREO" />
</ mixPort>

Audio output flags
AUDIO_OUTPUT_FLAG_PRIMARY (primary audio output, used as standard on most devices)
AUDIO_OUTPUT_FLAG_DEEP_BUFFER (Deep Buffer)

other flags
AUDIO_OUTPUT_FLAG_RAW
AUDIO_OUTPUT_FLAG_SLOW
AUDIO_OUTPUT_FLAG_DEEP_BUFFER


The list of audio compression formats from the highest to the lowest quality (this is not the entire list, but the most normal ones) (not all will be supported)
AUDIO_FORMAT_FLAC
AUDIO_FORMAT_ALAC
AUDIO_FORMAT_APE
AUDIO_FORMAT_VORBIS
AUDIO_FORMAT_WMA
AUDIO_FORMAT_WMA_PRO
AUDIO_FORMAT_MP3 (default)

Connecting 64 bit audio library instead of 32 bit
Make sure that lib64 has a folder and files in soundfx.
Log in /system/etc/audio_effects.conf
And change lib to lib64
/system/etc/audio_effects.conf
bundle {
path /system/lib64/soundfx/libbundlewrapper.so
}
reverb {
path /system/lib64/soundfx/libreverbwrapper.so
}
visualizer {
path /system/lib64/soundfx/libvisualizer.so
}
downmix {
path /system/lib64/soundfx/libdownmix.so
}
loudness_enhancer {
path /system/lib64/soundfx/libldnhncr.so
}

Third-party (ported) sound libraries
All audio libraries are usually stored in / system / lib (lib64) / soundfx
A list of standard effects with a description:
/libaudiopreprocessing.so
Audio pre-processing - processing of unprocessed sound before applying effects, cleaning bad areas and overloads in a track after alignment and normalizing sound to a specified level.
/libbundlewrapper.so
Low Frequency Amplifier and Normalizer
/libdownmix.so
Convert multichannel sound to dual channel
/libldnhncr.so
Enriching the stereo image of the incoming sound
/libreverbwrapper.so
Reverberation
/libvisualizer.so
Responsible for displaying visualization
Setting and connecting audio libraries
Connecting libraries using the example of a standard bass amplifier, the library is in libraries {up to closing brackets}
1. The line is responsible for the name and opens with a bracket.
2. String library location
3. Closing the function
With the library, there are unique uuid effects (sometimes they are not), added to effects {}
1. String effect name
2. The string name of the library that was written above.
3. String with uuid
4. Closing effect

libraries {

bundle {
path /system/lib64/soundfx/libbundlewrapper.so
}
}
effects {

bassboost {
library bundle
uuid 8631f300-72e2-11df-b57e-0002a5d5c51b
}
}





Samsung Galaxy S8 audio engine port
Beats Libraries
Sound effects port
Codecs from SONY, Samsung and other devices


Sound modifications
Making sound at the flagship level
A program that dumps an audioflinger and pulls basic information out of it.
Sound tuning and equalization in SRS Processing
Increase the volume of headphones and speaker through mixer_paths.xml
Adjust sound quality in mixer_paths.xml
Sound enhancement in build.prop

ALSA driver, its installation and configuration
In some devices this library is already installed, you can check in / system / bin alsa_ctl files should be alsa_aplay alsa_amixer (/system/lib/libasound.so sometimes only a library without binaries)
Installation
To run use the codeenter in the terminal
#! / system / bin / sh
mount -o rw, remount / system
mkdir / system / etc / alsa
chmod 0755 / system / etc / alsa
f = / system / etc / alsa / $ (cat /proc/asound/card0/id).state
alsa_ctl -f $ f store
chmod 0644 / system / etc / alsa / *
alsa_ctl -f $ f restore
mount -o ro, remount / system

Expand all files in folders from the archive, and give permission
Edit file permissions
/ bin / alsa_amixer 0755
/ bin / alsa_aplay 0755
/ bin / alsa_ctl 0755
/lib/libasound.so 0644
/ usr / share / alsa // all folders 0755, all files in the alsa 0644 folder

Driver for 32/64 bit processors:Attached filealsa_32bit.zip(405.16 KB)
(Restriction androyd from 4 to 6 above will not work)

Supplement put in / system / lib / hw with rights 0644 (can both positively and negatively affect the sound):Attached filealsa.default.so.zip(12.96 KB)


Ready script to run alsa:Attached filealsa.sh.zip(272 bytes)


# Non-standard
It has a high-quality audio processing algorithm.
Install with replacement, if this library is available in /system/lib/libasound.so, if it is not useless (perhaps there is an effect, but not sure) there should be no alsa binaries in / system / bin, otherwise the sound will disappear from the backup library,make a copy of the original for safety :)
Samsung GS8 + asound library:Attached filealsa_asound_sgs8 + .zip(262.15 KB)

Check ALSA works or not
Enter the code in the terminal
mount -o rw, remount / system
mkdir / system / etc / alsa
chmod 0755 / system / etc / alsa
f = / system / etc / alsa / $ (cat /proc/asound/card0/id).state
alsa_ctl -f $ f store
chmod 0644 / system / etc / alsa / *

The /system/etc/alsa/map_map.state file appears in the folder.
Then enter this command
alsa_ctl -f $ f restore
The sound will disappear for a while after it is turned on again, then the library is connected (if the sound does not appear, connect and disconnect the headphones)

Instructions for setting up ALSA




Adapted libraries to optimize sound for 32/64 bit processors
Libraries took from 6 androids, but should work on the versions below, since they are universal
IMPORTANT make backup system partition can not guarantee 100% of the libraries (the phone may hang on the eternal animation) , you can go through one by one and watch how the smartphone behaves
Installation: transfer all libraries with replacement to / system / lib and give rights0644
You can simplify the process of editing rights
su# get root
mount -o rw, remount / system# translation of the system partition in the record
chmod 0644 /system/lib/*.so# change of rights

Library list:
/libaudioflinger.so
/libaudioresampler.so
/libaudiospdif.so
/libaudioutils.so
/libeffects.so
/libinput.so
/libinputflinger.so
/libsonic.so
/libsonivox.so
/libsoundtrigger.so
/libspeexresampler.so
/libwebrtc_audio_coding.so
/libwebrtc_audio_preprocessing.so


In general, increases the overall volume, clarity, bass.
Attached fileaudio_engine.zip(1.24 MB)





Useful information
All methods of the audio output

Recommendations:
1. Use only the flagships of sound libraries. Since only data devices,
manufacturers make the maximum emphasis on the components of the device. Just soundfx folder
2. Many simply delete the folder soundfx from the device, and so, to make a clean exit of sound,
I am against this method because always resulted in a tin and live sound.

Restart the interface, so as not to wait for a long reboot, the changes also take effect
su
am restart

useful links


Post has been editedshimmer - 07.03.20, 20:12
Reason for editing: Updating a topic



Rep: (5)
* NOVATORZXC , I had a such a problem, replaced the cover and everything is in order, on the advice of the guys from the forum



Rep: (5)
* vilanders1 Really no cover no echo at all !!!! I dress cover back razgovarit not possible.



Rep: (5)
* vilanders1 , Only problem is that I have a little-known smartphone and find cover on it just is not realistic. Write to the risk that the Internet will echo again.



Rep: (0)
vitalycrazy @ 03.06.20, 12:27*
I have files vendor / etc / audio / audio_policy_configuration.xml

Sorry for the dumb question, but how do go to audio_policy_configuration.xml via adb?



Rep: (26)
Whether there is such that changes from flags in the audio policy configuration they do not apply at all no where and how !? Ie say I changed in the primary flag
<mixPort name = "primary output" role = "source" flags = "AUDIO_OUTPUT_FLAG_FAST | AUDIO_OUTPUT_FLAG_PRIMARY">
On
<mixPort name = "primary output" role = "source" flags = "AUDIO_OUTPUT_FLAG_DEEP_BUFFER | AUDIO_OUTPUT_FLAG_PRIMARY">
And he still drives for fast although the changes and save the file in the vendor is successful!
Is it in the bucket 10 is fixed in the train primary.so?



Rep: (36)
* vitalycrazy Yes it happens like this, and there is a problem 10 android also encountered this in the new body until it is sitting on 9



Rep: (26)
* skrillexartur,
On 9 generally had no problems .... Most Che sucks that not only is that 10 the encrypted file system so more pig planted with system files changes ..... Maybe there are options how to make the system notifications and ringtones as well as online radio drive on deep buffer?



Rep: (36)
* vitalycrazy , Well, if a mod for magiska gash then a ride, rather module

Post has been editedskrillexartur - 18.06.20, 22:38



Rep: (26)
* skrillexartur,
I only way you can! Tk handles can not be transferred to the vendor! Alas magisk powerless Management Board of file changes in a vendor but no result ... I can certainly something wrong when I correct you understand everything correctly can help to register?



Rep: (5)
Hello, I can not in any way increase the speaker volume, and change the values ​​of no avail, Xiaomi mi6



Rep: (29)
* Searc86,
So not the soap has a block, or the mixer, android rivet tak old files are not deleted, and inserted new turns trash.
you look carefully the folder system / etc and vendor / etc and find all the word mixer
the idea is mixer_paths_tasha.xml, but the idea is kvalkomovsky mixer.paths.xml can still be mixer_paths_wcd9335.xml (in MI6 like this Audio Codec) and mixer_paths_tavil.xml.
What is the current one Krc.
Krc find all the files and proceed from that.
I have been in all.
line on the idea RX0 Digital Volume

Post has been editedCats is London - 20.06.20, 23:44



Rep: (29)
Please tell me, did I already sound output dip buffer with 16 bit depth and frequency of 192,000, but it does not go to change the bit depth from 16 to 24, which is used by default in the system plays a sound 24/192, how to do it ??? Picking his konfiguration policy.



Rep: (29)
And all brought by default 24/192



Rep: (29)
Shorter brought 32/384 in the system, simply chic, moreover, that the phone RN5



Rep: (535)
igor18981898 @ 22.06.20, 15:17*
Shorter brought 32/384 in the system, simply chic, moreover, that the phone RN5
That's funny. After standing in RN5 Snapdragon 636 supports output only up to 24 bit 192KHz.

Attached Image


https: //www.qualcomm.c...on-636-mobile-platform



Rep: (5)
* A $ teroid And how do I know what a mine in the sound processor. On the internet I could not find the information. Processor MTK helio P23.



Rep: (535)
* NOVATORZXC You can look for the binarytinypcminfo. Sometimes it is a part of the firmware.

on the card capability information is displayed in the terminal commandtinypcminfo -d 0

Example
Attached Image


If you want, I can throw off your binary, but it is a 32-bit ARM.



Rep: (29)
I do not have disk imaging writes not found



Rep: (70)
* igor18981898 ,
A $ teroid @ 22.06.20, 17:14*
Sometimes it is

Do not always (as, for example, and I do not have)

Post has been editedNaomo - 22.06.20, 17:38
Reason for editing: Fail



Rep: (28)
Greetings, colleagues. I am honored cap. I have a question. Old as the world, apparently. I even smoked XDA Developers.
If yet to start only edit text config files, do not install binary nothing, no libraries or codecs,
that we are talking exclusively about everywhere mixer_paths.xml, as well as in our cap.

But, there is next to it the darkness, several thousands of other mixer_paths _ *. Xml. In the sense that they do not 2 or 3, that is, I could
pougadyvat by ear, but many. So, if the pro audio output (max. Volume), what exactly does each mixer_paths _ *. Xml?

The task at Mey simple - Xiaomi Mi Max 3, suppose a custom firmware to v12 and MIUI Android v10,
which is already in kastomov some sound moditsikatsii at binaries, binary do not touch anything,
only the maximum speed volume and nothing else, not bitrate and codec. So this is where it is for a specific device exactly where
of the aforementioned XML? Under the earpiece, alarm clock, incoming calls, wired headphones
and BlueTooth headphone (audio-video). I understand different XML these are really involved. Or not?


Full version    

Help     rules

Time is now: 22/07/20, 8:57