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: (13)
* Roman_city,
SURPRISE FOR SURPRISE, how to manage it?



Rep: (282)
* codore1,
it does not have an interface



Rep: (13)
* Roman_city,
I rummage about it, what’s the matter with him, where what configs are responsible for?



Rep: (13)
* Roman_city,

"We need testers for the Samsung Galaxy S8 engine," he wrote

jack_alsa_mixer.json offal:
{
"device": "configure",
"params":
[
{"name": "loopback", "value": "2"},
{"name": "device", "value": "alsa"},
{"name": "samplerate", "value": "48000"},
{"name": "period", "value": "960"},
{"name": "nperiods", "value": "2"}
]
}
]

can I change?

Post has been editedcodore1 - 24.10.17, 02:51



Rep: (282)
* codore1,
it is configured to the maximum, but you can these files mixer_gains.xml, floating_feature.xml, sapa config (there is a description of everything there)



Rep: (13)
* Roman_city,
jack_alsa_mixer.json offal:
{
"device": "configure",
"params":
[
{"name": "loopback", "value": "2"},
{"name": "device", "value": "alsa"},
{"name": "samplerate", "value": "48000"},
{"name": "period", "value": "960"},
{"name": "nperiods", "value": "2"}
]
}
]

can I change?

Audio_effects.conf gone? Should it be so? if so then what is the use of libraries that are in the engine in the soundfx folder?
saw everything, he moved to the vendor folder)

By the way, I have long wanted to know the Vendor folder for what?

Post has been editedcodore1 - 24.10.17, 03:26



Rep: (3)
* Roman_city I can be a tester. If started on an 8 bucket.



Rep: (13)
Is it possible to port audio fx from samsa in general?



Rep: (282)
* codore1,
jfck_alsa we don’t recommend touching the sound, it got worse, for this, use audio_effects_sec.conf b audio_effects.conf in the vendor
the vendor is an auxiliary folder with additional libraries
you can port everything

Post has been editedRoman_city - 24.10.17, 11:14



Rep: (13)
* Roman_city , it would be nice to get hold of their music fx



Rep: (13)
* Roman_city,
You did not encounter a bug, after a while the music started to be started and the frequency drops to 8KHz. I think the problem is in the compression of the load but I do not understand where to dig.
Maybe audio.offload.buffer.size.kb = 1024 is not enough for him?

Post has been editedcodore1 - 24.10.17, 11:34



Rep: (282)
* codore1,
I didn’t see the frequency, it can’t fall, I use the frequencies prescribed in the audio policy, audio.offload.buffer.size.kb (ideally 64-128) it's too much I don’t use it, remove the compression from the headphone output



Rep: (13)
* Roman_city,
For more details?
Build Prop
audio.deep_buffer.media = true
ro.sound.driver = alsa
ro.sound.alsa = snd_pcm
default.pcm.rate_converter = samplerate_best
ro.audio.samplerate = 96000
ro.audio.pcm.samplerate = 96000
persist.audio.samplerate = 96000
persist.audio.pcm.samplerate = 96000
persist.af.resample = 96000

audio_hal.period_size 240
af.fast_track_multiplier 2
audio.offload.video = false
audio.offload.min.duration.secs = 30
audio.offload.pcm.enable = true
audio.offload.buffer.size.kb = 1024
audio.offload.disable = 0
audio.offload.pcm.32bit.enable = true
audio.offload.pcm.24bit.enable = false
audio.offload.pcm.16bit.enable = false
audio.offload.gapless.enabled = false
audio.offload.multiple.enabled = true
audio.offload.passthrough = false
audio.offload.track.enable = true
persist.audio.offload.pcm.samplerate = 96000
persist.audio.offload.samplerate = 96000
tunnel.audio.encode = false

#MTK_AUDIO_BLOUD_CUSTOMPARAMETER, V1-V5
ro.mtk_audio_tuning_tool_ver = V2.2


Police
global_configuration {
attached_output_devices AUDIO_DEVICE_OUT_EARPIECE | AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_TELEPHONY_TX
default_output_device AUDIO_DEVICE_OUT_SPEAKER
attached_input_devices AUDIO_DEVICE_IN_BUILTIN_MIC | AUDIO_DEVICE_IN_VOICE_CALL | AUDIO_DEVICE_IN_REMOTE_SUBMIX | AUDIO_DEVICE_IN_TELEPHONY_RX
audio_hal_version 3.0
drc_spk_attn_curve_system -55.0 | -30.0 | -15.0 | -10
drc_spk_attn_curve_combo -29.7 | -20.1 | -10.2 | 0
drc_spk_attn_curve_media -56.0 | -39.5 | -17.5 | 0
}

audio_hw_modules {
primary {
outputs {
primary {
sampling_rates 44100 | 48000 | 64000 | 88200 | 96000 | 176400 | 192000 | 352800 | 384000
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_32_BIT | AUDIO_FORMAT_PCM_24_BIT | AUDIO_FORMAT_PCM_16_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
}
deep_buffer {
sampling_rates 44100 | 48000 | 64000 | 88200 | 96000 | 176400 | 192000 | 352800 | 384000
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_32_BIT | AUDIO_FORMAT_PCM_24_BIT | AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_EARPIECE | AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_ALL_SCO | AUDIO_DEVICE_OUT_AUX_DIGITAL | AUDIO_DEVICE_OUT_PROXY | AUDIO_DEVICE_OUT_FM | AUDIO_DEVICE_OUT_FM_TX
flags AUDIO_OUTPUT_FLAG_DEEP_BUFFER
}
direct_pcm {
sampling_rates 44100 | 48000 | 64000 | 88200 | 96000 | 176400 | 192000 | 352800 | 384000
channel_masks AUDIO_CHANNEL_OUT_STEREO | AUDIO_CHANNEL_OUT_2POINT1 | AUDIO_CHANNEL_OUT_QUAD | AUDIO_CHANNEL_OUT_PENTA | AUDIO_CHANNEL_OUT_5POINT1 | AUDIO_CHANNEL_OUT_6POINT1 | AUDIO_ANN
formats AUDIO_AUDIO_FORMAT_PCM_32_BIT | AUDIO_FORMAT_PCM_24_BIT | AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_EARPIECE | AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_ALL_SCO | AUDIO_DEVM_OUT_UTEV_TEV_TEV
flags AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_DIRECT_PCM
}
multichannel {
sampling_rates 44100 | 48000 | 64000 | 88200 | 96000 | 128000 | 176400 | 192000 | 352800 | 384000
channel_masks dynamic
formats AUDIO_FORMAT_PCM_32_BIT | AUDIO_FORMAT_PCM_24_BIT | AUDIO_FORMAT_PCM_16_BIT
devices AUDIO_DEVICE_OUT_AUX_DIGITAL | AUDIO_DEVICE_OUT_PROXY
flags AUDIO_OUTPUT_FLAG_DIRECT
}
compress_offload {
sampling_rates 44100 | 48000 | 64000 | 88200 | 96000 | 176400 | 192000 | 352800 | 384000
channel_masks AUDIO_CHANNEL_OUT_STEREO | AUDIO_CHANNEL_OUT_2POINT1 | AUDIO_CHANNEL_OUT_QUAD | AUDIO_CHANNEL_OUT_PENTA | AUDIO_CHANNEL_OUT_5POINT1 | AUDIO_CHANNEL_OUT_6POINT1 | AUDIO_ANN
formats AUDIO_FORMAT_MP3 | AUDIO_FORMAT_AC3 | AUDIO_FORMAT_E_AC3 | AUDIO_FORMAT_PCM_24_BIT_OFFLOAD | AUDIO_FORMAT_AAC | AUDIO_FORMAT_AAC_LC | AUDIO_FORMAT_AAC_HE_V1 | AUDIO_FORM
devices AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_EARPIECE | AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_OUT_OUT_OEV__EVICE_OEV__EVICE_OEV__EVICE_IOEVIT_ITEVIT_OEV__EVICE_IOEVIT_ITEVIT_OEVIT_ITEVIT_ITEVIT_OEVIT_ITEVIT_OEVIT_ITEVIT_ITEVIT_ITEVIT_ITEVIT_ITEVIT_ITEVIT_ITEVIT_Ivice_oot_tve_tive_tve_tive_tive_ito_tive_ito_tive_outice_tive_tive_outice_tive_tive_outice_tive_outice_utice_tice_tive_outice_tive_tive_outice_tive_out
flags AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD | AUDIO_OUTPUT_FLAG_NON_BLOCKING
}
}
inputs {

where could I fix it?

Post has been editedcodore1 - 24.10.17, 12:32



Rep: (282)
* codore1,
in build.prop complete mess, remove everything (all together negatively affect the sound)
in audio policy use only one bit 24 or 32 (also use only one sampling rate), so you give a choice to the system, remove everything from deep buffer (leave only 48000 in depp buffer)
here is my
audio_hw_modules {
primary {
outputs {
primary {
sampling_rates 384000
channel_masks AUDIO_CHANNEL_OUT_STEREO
formats AUDIO_FORMAT_PCM_32_BIT
devices AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE | AUDIO_DEVICE_OUT_ALL_SCO | AUDIO_DEVICE_OUT_AUX_DIGITAL
flags AUDIO_OUTPUT_FLAG_PRIMARY
}
}


Post has been editedRoman_city - 24.10.17, 12:50



Rep: (13)
Hanged while loading "Launch Android". After leaving 32 bits 384 and cleared the prop build.



Rep: (282)
* codore1,
the phone does not support 32 bits or 384 put less
the phone may not turn on due to the sampling rate

Post has been editedRoman_city - 24.10.17, 13:16



Rep: (802)
32 bits 384
where so much on the 5th Android?



Rep: (13)
* Roman_city,
I will do a test for 32 bits 96 for a start .--->
--->Startanul --->no sound

Post has been editedcodore1 - 24.10.17, 13:27



Rep: (282)
* codore1,
try 24 bits
just edit audio_policy and there will be hi res audio (and which players are not needed)

Post has been editedRoman_city - 24.10.17, 13:52



Rep: (13)
* Roman_city,
checked up to samsung mod 32 192 everything is fine sound is
with a mod above 16 48, the sound does not start, the mod output needs to be finished, and even if you remove the policies, leave the system without it on the Samsung mode, the system should use the system policy, but there is sound but when the headphones are connected, it plays on the speaker, a cool mod)

Post has been editedcodore1 - 24.10.17, 13:57


Full version    

Help     rules

Time is now: 21/06/20, 16:26