Modification and improvement of sound quality | 4.0+



Rep: (290)
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
Collection modification
Sound modifications
Increase the volume of the microphone when video
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 - 26.12.20, 22:56
Reason for editing: Increasing the microphone volume when video filming



Rep: (279)
Hrenanado @ 10/22/17, 10:44*
Hrenanado
if you listen to 16/88200 is not bad) I like it.



Rep: (506)
* tranceman111 , .. the main thing is that you like what you hear, and the numbers are just numbers ..: derisive:



Rep: (279)
Hrenanado @ 10/22/17, 23:31*
tranceman111, .. the main thing is that you like what you hear, and the numbers are just tsiferki ..
agree. But partly tsiferki sound also affect)



Rep: (3)
Roman_city
Should DAC be specified in ProjectConfig.mk?



Rep: (290)
* winston6,
not



Rep: (22)
Tranceman111 @ 10.23.17, 2:44*
still resample in 16/48000
Do you have an on or off bootloader?



Rep: (290)
Codecs

Bluetooth LDac codec from SONY XZs:Attached fileldac_bt_enc.zip(20.56 KB)



Rep: (279)
* deniska817 , unlocked, but without c-off.

By the way I made a high cut.

Attached images
Attached Image



Rep: (14)
* tranceman111,
is that such a problem to get 32 ​​bits 192 ?, even 64 192 is not a problem, I would have seen 384 on my own, yes)

Posted on 10/24/2017, 01:08:

* Roman_city,
and the sense of the codec if it only plows on this MDR-1ABT



Rep: (506)
* codore1 ,
Attached Image

: heppy_dancing:




Rep: (14)
* Hrenanado but in fact is it so? at the exit? took measurements?



Rep: (506)
* codore1 , .. no, nonsense .. Just tsiferki in the player’s interface, in fact 48000 ..: resent:



Rep: (14)
* Hrenanado
and mnu in fact managed to give him a maximum of 96 and the whole limit above drops to 44.1



Rep: (290)
* codore1,
he is working on any headphones, checked the difference in sound is palpable, to replace aptx

Post has been editedRoman_city - 24.10.17, 01:37



Rep: (14)
* Roman_city,
What do you recommend to increase the size of the scene, align the frequency response and make the sound more transparent? maybe your beat audio will work out only there is a bunch of everything, but I don’t need everything, I think there will be a bunch of files lying around just like that.

Posted on 10/24/2017, 01:39:

* Roman_city,
Interestingly, this is the standard from Sony for Sony and plows on other ears. That is, it turns out that Sony took something ordinary and wrapped it in a beautiful wrapper?
I’ll then take note of the codec for BT suddenly come in handy)

Post has been editedcodore1 - 24.10.17, 01:42



Rep: (290)
* codore1,
only effetami (but I haven’t laid it out yet), or to put a sound engine, I can offer an engine from sgs (a few people have already unsubscribed)

maybe you are right

Post has been editedRoman_city - 24.10.17, 01:48



Rep: (14)
* Roman_city,
Let’s try it, I don’t want to clog mods from other phones, which are mainly on snap, I have unfortunately MTK (of course, the sound on the snap will be similar to mine. For no one knows what kind of sounds put in one or another process.)

Post has been editedcodore1 - 24.10.17, 01:51



Rep: (290)
* codore1,
https://yadi.sk/d/IwjXaMPQ3P2q9the is from an excinos

Post has been editedRoman_city - 24.10.17, 01:52



Rep: (14)
* Roman_city,
Will it start on 5 android?



Rep: (290)
* codore1,
yes, the uninstaller will be on the internal memory if that

Post has been editedRoman_city - 24.10.17, 02:18


Full version    

Help     rules

Now: 06.02.21, 08:53