Stupid simple tweak to improve Pulseaudio audio quality

Today (while messing with my N2+) I came across a stupid simple tweak to improve audio quality.

Ready?

Edit /etc/pulse/daemon.conf (or $HOME/.pulse/daemon.conf) and set:

resample-method = soxr-vhq

Restart pulseaudio (e.g. killall pulseaudio or reboot) and… vastly improved audio quality.

This might increase CPU use but the difference is not noticeable on any system I’ve tried it on; soxr-mq and soxr-hq are also available if needed.


If soxr-vhq is not supported by your system then speex-float-10 is also a good option.

There’s a range from speex-float-1 (lowest) to speex-float-10 (highest) which will balance quality/CPU use, but given -10 doesn’t take pulseaudio above 1% on one CPU on my N2+ it’s pretty negligible.

You can check the output of pulseaudio --dump-resample-methods to verify which are supported on your particular system.

16 Likes

Will have to try this out, cheers!

What about resample-method = src-sinc-best-quality?
I have been using that for quite some time. It was once recommended somewhere in an audio forum.

Apparently those src-sinc-* methods have been deprecated and revert it to auto (according to a Reddit thread I read… so might not be accurate).

OK, thanks

When I looked at my /etc/pulse/daemon.conf file, every line was commented out with a leading semi-colon.

I know you installed EndeavourOS Arm differently, was all your lines commented out? If not, could you possibly list the daemon.conf?

I am having a problem on my RPi4b with stuttering or skipping. The solution is to bypass Pulseaudio and use ALSA. I am wondering if something in the deamon.conf could fix this?
Ah yes, something to play with.

Pudge

EDIT:
Thanks for the tip. Even with my 70 year old ears with mild tinnitus could actually hear the difference. I know this is subjective, but I am convinced this is noticeably better.

Pudge

2 Likes

Yes, the file provides the defaults with the lines commented out.

Quite possibly - there are some tweaks that can be made, though it can also be the driver or just system load at fault. There are quite a few pointers over on

https://wiki.archlinux.org/index.php/PulseAudio/Troubleshooting

1 Like

What is more advantageous to edit the /etc/pulse/daemon.conf or $HOME/user/.config/pulse/daemon.conf)?

/etc/pulse/daemon.conf will configure this globally for every user on a linux computer.
$HOME/.pulse/daemon.conf will configure this on a user by user basis, and I believe this will over ride the /etc/pulse/daemon.conf in case one user wants a different setting than set in the global setting.

If your computer only has one user defined, it will work the same either way.

Pudge

6 Likes

Having recently upgraded my desktop speakers, I was quite intrigued with the topic so I ended up diving a little further into the topic and found a few more tweaks to try. For those interested, the following is condensed from Beginners Guide for better Audio Quality in Linux and Enable High Quality Audio on Linux.

I’m currently experimenting on my desktop with the following changes:

resample-method = soxr-vhq
default-sample-format = s24le
default-sample-rate = 48000
alternate-sample-rate = 44100

List available resample methods with pulseaudio --dump-resample-methods. Latest processors can use soxr resample-methods, which are supposed to offer better audio quality than speex based methods, but are more cpu intensive.

For sample format the defaults is 16-bit, which is used in music streaming services and generally many audio files. 24-bit is used in higher res audio like FLAC and some premium audio streaming services. So, if you have 24-bit FLAC , ALAC files or other high quality audio (DTS, Dolby…etc) files go for 24-bit. Now 32-bit is for professional recording in studios. In general, desktop users don’t need this.

NOTE: The Endianness of the cpu should be checked before changing the default-sample-format with lscpu | grep 'Byte Order'

Change the default-sample format according to your preference. Most are obvious–using the le or be suffix for Little Endian and Big Endian respectively, but I’m unsure what ulaw and alaw are for.

u8, s16le, s16be, s24le, s24be, s24-32le, s24-32be, s32le, s32be float32le, float32be, ulaw, alaw

As always, your mileage may vary and some trial and error might be necessary for best results.

7 Likes

@jonathon you superstar :pray:

perfect on pinebook pro … better very much now :pray:

4 Likes

I am not a audiophile so I don’t hear a change, but if it is better then I shall take your word for it.

This will be added to my install script!

2 Likes

It’s possible that setting to “auto” will scale depending on e.g. the CPU… all I know is that when I switched my N2+ to ALARM its audio was terrible with certain audio sources (with a load of artefacts like a low-bitrate MP3), then I switched the value and the difference was striking.

1 Like

Note that “speex” can introduce a lot of latency, which might be a concern when you record audio.
An alternative is “soxr-vhq”.

2 Likes

JACK ftw :partying_face:

1 Like

I’ve been trialling soxr-vhq since @sothis6881 mentioned it above and although it’s supposed to need more CPU I haven’t noticed any real difference between it and speex-float-10:thinking:

That’s not a “stupid simple tweak” though. :stuck_out_tongue_closed_eyes:

3 Likes

While you’re at it, also consider changing the sampling format in the same file, e.g.:
default-sample-format = s32le (if the sound device supports it)
:slight_smile:

3 Likes

This is my current actual config on my laptop with external DAC:

default-sample-format = float32le
default-sample-rate = 96000

resample-method = soxr-vhq
flat-volumes = no

realtime-scheduling = yes
rlimit-rttime = -1
exit-idle-time = -1

but this adds some extra stuff that is more specific than just a nice general tweak.

(Yes, flat-volumes=no is default on Arch but I’m not taking any chances…)

1 Like

Sample rate higher than 44100 should certainly affect CPU load, if you care about that :slight_smile:

speex-float-10 or anything speex-* just sounds way too drowned out for me, maybe I was setting it up wrong. Either way, soxr-vhq is brilliant and in my opinion, along with a few other tweaks, greatly improves audio quality.

3 Likes