Audio crackling on Ubuntu.

Debian_SuperUser

Active Member
Joined
Mar 18, 2024
Messages
161
Reaction score
41
Credits
1,949
On earphones, there is loud audio crackling sometimes when audio is played. The results I have found show to change the sampling rate in /etc/pulse/daemon.conf. I don't have a daemon.conf. Only a client.conf, which does not have the setting written in it. Do I still write the setting in that, or make a new daemon.conf? I am asking this because Ubuntu 24.04 LTS actually uses pipewire and in etc, I still couldn't find any sampling related setting regarding pipewire.
 


I'm necroposting this but whatever, it's important that the solution to this is known.

Audio crackling is usually caused when your system and application's audio latency is too low/fast for what your CPU can handle either generally or at the moment. You can change the latency settings in /etc/pipewire/pipewire.conf and /etc/pipewire/pipewire-pulse.conf.

Latency (in seconds) is defined by this formula:
Code:
quantum_size / sample_rate
For milliseconds:
Code:
quantum_size / sample_rate * 1000

Example: for 48KHz, a quantum size of 512 will result in approx. 10.7ms of latency (512/48000*1000 ms)

pipewire.conf

Scroll down until you find default.clock.rate, default.clock.allowed-rates, etc

You can adjust latency by modifying the values of default.clock.quantum, default.clock.min-quantum and default.clock.max-quantum. Higher values mean more latency but less audio crackling and CPU usage.

By default applications use the default size, but some applications specify to use the minimum quantum value (such as wine) and others specify to use the maximum value (web browsers)

pipewire-pulse.conf​

Pipewire-pulse is also necessary since most applications do not support native pipewire.

Scroll down until you find pulse.min.req, pulse.default.req, pulse.min.frag, pulse.min.quantum, etc. Modify these values just like you did for pipewire.conf.
pulse.min.frag is used for audio capture, and so you can set it to a very high latency value without any problem, the others are for audio playback and so you should follow the same idea of what you did for pipewire.conf

There is also a node.latency setting in stream.properties if you scroll up, you can change that but I don't know if it changes anything
 
Last edited:


Follow Linux.org

Members online


Top