Debian 12 “bookworm” comes with a new and improved sound server called PipeWire. It brings noticable sound quality and latency improvements over PulseAudio. Here is an article describing the differences in detail.
Although PipeWire is a huge improvement, under the hood the new sound server still relies upon ALSA which is a kernel-level API for handling sound in Linux. Out of the box, ALSA defaults to a sample rate of only 48000Hz. Most people won’t notice, but for users who really care about sound quality, this is not acceptable. The majority of modern sound hardware (DACs in particular) are capable of much more.
Here are the steps to take if you want to fix this and improve your Linux sound quality experience.
First, we need to determine your sound card’s capabilities. This is how you list all of your audio devices on your computer:
$ aplay -l
...
card 1: Audio [VIA USB Audio], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
...
If this is your sound card, you would be using card 1, device/stream 0. Use the following commands to determine all supported sample rates:
$ cat /proc/asound/card1/stream0
...
Interface 1
Altset 1
Format: S24_LE
Channels: 2
Endpoint: 0x05 (5 OUT) (ASYNC)
Rates: 44100, 48000, 88200, 96000
Data packet interval: 125 us
Bits: 24
...
So our sound card supports a maximum sample rate of 24-bit, 96000Hz, (LE) Little Endian. What we want to do now is edit the ALSA config file to tell it to use this sample rate. We will also tell it to use a higher quality rate converter when playing sounds that are less than 96kHz. Open the file for editing:
$ sudo nano /etc/asound.conf
So for our example, we are card 1, device 0, S24_LE, and 96000. So you will want to add the following to your /etc/asound.conf file, changing the values to suit your sound card:
pcm.device{
format S24_LE
rate 96000
type hw
card 1
device 0
rate_converter "samplerate_best"
}
Save the file. It should take effect once you restart. You can confirm the changes using the following command:
$ pactl info