Beginners Guide for better Audio Quality in Linux

Audio in Linux

Edit: Latest developments happen in Linux world quickly. So there is new audio server called “Pipewire” which has potential to replace Pulseaudio and Jack audio servers. Pipewire is great in everything. I don’t have all the details but if anyone is interested, check the link below. I have heard that this will be shipped with Fedora 34.

PipeWire

PipeWire — ArchWiki (archlinux.org)

Audio quality in any Linux distribution when compared to Windows or Mac operating systems is bad. Why…? read the below paragraph for short info.

It is because of the audio drivers. The audio chip manufactures(for ex: Realtek) develops drivers only for windows operating system. Where as Apple creates it’s own hardware and software, so there is no question of driver problem here. In case of Linux, the open source community develops drivers. The problem here is, developers don’t know the correct specifications of the audio hardware and the audio driver should work for most hardware. That is why audio quality in Linux is bad.

After wondering why audio quality in Windows is much better than Linux. I realized and found that, the default audio drivers in Windows OS has a built -in equalizer that amps-up bass and drums. On top of this, the audio hardware vendors such as RealTek provide the proper drivers for the hardware. So that is why audio feels rich on Windows.

In Linux, there is no magical equalizer. There is pulseaudio equalizer, but you have to tweak and tune it yourself. The second downside is the hardware vendors don’t provide audio drivers for Linux. Hence, the difference in audio quality.

Keeping this in mind, i thought of an easy guide for beginners like me to get best output.

This guide gives the simple and easy way to get good audio quality in any Linux distro. Follow the below 2 steps.

We should change the default settings in the pulse-audio config file. This file is generally found in /etc/pulse/daemon.conf. Before changing any settings, keep a backup of daemon.conf file in any other location.

Note: In the daemon.conf file, all the default settings are commented using “#(Hash) or ;(semi-colon)”. To change a setting, just copy-paste default setting to the next line, uncomment the setting and change it.

1.Change the resample-method: By default, in all distro’s the resample-method is speex-float-1. Here, the range is from 1(Low) to 10(Best). Higher the value, better the audio quality and demands high cpu usage. This also depends on the cpu. To know the resample-methods supported by the cpu, run the following command in terminal.

pulseaudio — dump-resample-methods

For desktop, use speex-float-10. For latest processors, use soxr resample-methods. soxr methods offer better audio quality than speex based methods. But they are cpu intensive compared to speex methods.

For laptops, speex-float resample-methods are best. I recommend using speex-float-5, speex-float-6 or speex-float-7. Check the cpu-usage of pulseaudio process and choose the best resample method that fits perfect between battery life and audio-quality of laptop.

2.Change default-sample-format: The Endianness of the cpu should be checked before changing the default-sample-format. This can be easily found by entering the following command in terminal.

lscpu | grep ‘Byte Order'

Now we have 8-bit, 16-bit, 24-bit and 32-bit sample formats. Currently, 8-bit audio is rarely used(It is older). 16-bit is used in music streaming services and generally many audio files. 24-bit is known as High-Res audio. FLAC and Apple’s ALAC lossless audio codecs use 24-bit audio. Some premium audio streaming services use 24-bit audio. 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.

change the default-sample format according to your preference. By default, most distros use s16le (for little Endian CPU) or s16be (for big Endian CPU).

Here 16 in s16le or s16be means 16-bit. change the number from 16 to 24 for 24-bit. same goes for 32-bit.

After the changes, save the daemon.conf file and reboot the system. Play any audio file and check the quality.

I love science and technology. ML, DL enthusiast