Modification and improvement of sound quality | 4.0+



Rep: (285)
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: (285)
* codore1,
This does not apply to him, as I checked?
if the audio policy does not work then it does not support
without audio policy sound will not be output or with problems

Post has been editedRoman_city - 24.10.17, 14:00



Rep: (13)
* Roman_city,
audio_hw_modules {
primary {
outputs {
primary {
sampling_rates 192000
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_32_BIT
devices AUDIO_DEVICE_OUT_EARPIECE | AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_BLUETOOTH_SCO | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET | AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT | AUDIO_DEVICE_OUT_AUX_DIGITAL | AUDIO_DEVICE_OUT_PROXY | AUDIO_DEVICE_OUT_FM | AUDIO_DEVICE_OUT_FM_TX
flags AUDIO_OUTPUT_FLAG_PRIMARY

so I checked

Post has been editedcodore1 - 25.10.17, 22:23
Reason for editing:



Rep: (13)
Roman_city @ 10.24.17, 12:56*
without audio policy sound will not be output or with problems
here you are wrong if the system is not pure android, it is possible.
BUT read what audio policy is and how android eats it.
audio.primary.default
audio.primary.your percent.so
these bibles are responsible for flags and the rest if there is no policy in the system using the standard configurator that is registered in these libraries.
these bibles are compiled using the audio.h, audio_polysy.h and other crap files.

Anyone who has the sorts of his system is very lucky because he can make the system work as he needs. Obviously, manufacturers are not really bothered and do not really set up Android media, but they are sawing crutches.

Post has been editedcodore1 - 24.10.17, 14:12



Rep: (285)
* codore1,
remove the code under the spoiler,
without an audio policy it is not possible to transfer sound to a2dp, headphones, maybe you have done something else
the engine has nothing to do with this
https://yadi.sk/d/gG7kLMUP3P3TARyou can test it, at first only

Post has been editedRoman_city - 24.10.17, 14:12



Rep: (13)
* Roman_city,
I can’t edit that message.
What are the changes compared to version 6?

Post has been editedcodore1 - 24.10.17, 14:15



Rep: (285)
* codore1,
removed audio policies from Samung

if it doesn’t change, try to put 32/192 without an engine

Post has been editedRoman_city - 24.10.17, 14:30



Rep: (13)
* Roman_city ok right now
7 version of changes in the system is not set; I do not see. Rather, my fault was to remove unicaler from SD after backup

Post has been editedcodore1 - 24.10.17, 15:02



Rep: (285)
* codore1,
How not to put it? / lib / soundfx is there such a folder?
he has nothing to do with uninstall

Post has been editedRoman_city - 24.10.17, 15:15



Rep: (13)
"/system/lib/soundfx/libharmancorehtc.so excites the high frequency spectrum, the voices are cleaner "I was interested in this, will it be enough bibles and weeds? Or something else should be twisted to it?

Post has been editedcodore1 - 24.10.17, 15:06



Rep: (285)
* codore1,
could be so



Rep: (13)
* Roman_city,
Version 7 doesn’t put anything, even prop doesn’t put anything in the build, version 6 also doesn’t put a nifig now, why the hell?

Post has been editedcodore1 - 24.10.17, 15:36



Rep: (285)
* codore1,
I do not know



Rep: (3)
* Roman_city ,

Attached files

Attached filesbor.txt(8.47 KB)



Rep: (285)
* sergey248734
* sergey248734
* sergey248734
* sergey248734
need without installed engine

Post has been editedRoman_city - 24.10.17, 18:22



Rep: (3)
* Roman_city ,

Attached files

Attached filesbor.txt(7.5 KB)



Rep: (3)
* Roman_city , * Roman_city ,

Attached files

Attached filebackup_s8.zip(742.78 KB)



Rep: (33)
and beats audio, it’s written in the spoiler that not all libraries are immediately shoved, but which ones are desirable? can have edited?



Rep: (285)
* lifeketsvil,
You can completely put the bits there, there is a link, and then configure
Premier add-in, lies in / system
rest in beats expansion

Post has been editedRoman_city - 24.10.17, 23:06



Rep: (13)
Was wrong, though: blush:
TTX of my codec
Attached Image

TTX of my DAC
Attached Image



Rep: (152)
* codore1 Sanya, good rebate, and I what he did the last three months ??? all of the patches that gave, all with partial inclusion Harman
psi yet, such a question, is it possible settings from htc, paragraph incorporating Harman cross to the example of our setting, to the settings menu option enable Harman Kardon? that's just the only thing that did not happen until the Harman system works only half, but the sound changes in the implementation of the system

Post has been editedpapadim1002 - 25.10.17, 10:41


Full version    

Help     rules

Time is now: 11/09/20, 7:58