23

I'm a novice Linux user. I'm currently using Xubuntu 11.10

I like getting the best I can out of my hardware. This includes sound. In windows it was quite simple. I just went to the audio settings and set the bit depth and sampling rate to the biggest values available.

With Xubuntu though, it's a little more tricky. There is no advanced settings in the graphic configurator. That means I have to look for bit depth and sampling rate in a configuration file. The thing is, I don't know which one exactly.

If anyone could tell me which one it is and which lines I have to modify, I would be grateful.

Takkat
  • 142,284
Yasashii
  • 231

3 Answers3

28

To change the sample rate and audio bit depth we need to edit the configuration file for the pulseaudio server /etc/pulse/daemon.conf

Please backup the original settings to restore the defaults in case som settings break your audio.

Look for the following entries:

; default-sample-format = s16le
; default-sample-rate = 44100

Both are commented out with ;. This means they are not read as the entries given here are the defaults. Uncoment them and replace them with values that suit you better. Always keep in mind that this may be on cost of system performance or stability when choosing extreme values.

Possible entries for the sample format are: u8, s16le, s16be, s24le, s24be, s24-32le, s24-32be, s32le, s32be float32le, float32be, ulaw, alaw

Possible entries for the sample frequency are anything between 1 and 192000 Hz (choose sensible values!)

Save this file as ~/.pulse/daemon.conf or in it's original location (you need to be root then). In order for changes to take effect pulseaudio needs to be restarted with pulseaudio -k in a terminal, or by log out and log back in.

Takkat
  • 142,284
  • I made the mistake of adding a ~/.pulse/daemon.conf file to fix a problem with an old Logitech webcam and forgot about it. The old webcam required a setting of default-sample-rate = 16000, which was ruining the audio of a new webcam. Deleting this line fixed the problem. – Allan Bogh Jan 02 '21 at 01:20
  • @Allan yeah, it always is a good advice to rename/delete files in ~/.config/pulse or ~/.pulse in case of sound issues. – Takkat Jan 02 '21 at 05:46
  • 1
    How do you do this without pulse audio? I hate pulse audio, it's caused me literally hundreds of pounds worth of damage, so i refuse to use it, it's also totally unnecessary. – Owl Apr 19 '22 at 10:48
  • 1
    One of the best posts I've ever seen, for an audiophile on Ubuntu I love having these settings to play with. <3 – Thomson Comer Jun 22 '22 at 23:05
  • It is better to copy /etc/pulse/daemon.conf to /etc/pulse/daemon.conf.d/01-custom.conf and make changes there. This way whenever the mainteiner version changes, there will be no merge conflicts. Run pulseaudio --dump-conf to check your configuration. – George Valkov Oct 02 '22 at 20:34
  • I did everything as mentioned, when I check pacmd list-sinks, the bitrate doesn't change. I want to change 24le to 16le. Can anyone help? – UserRR Dec 05 '22 at 07:43
  • 1
    @UserRR: the local directory for the user edited daemon.conf may today be in ~/.config/pulse – Takkat Dec 05 '22 at 20:45
  • @UserRR Did you restart the PulseAudio server after you have made the changes? – David Ferenczy Rogožan Sep 22 '23 at 17:13
10

Above answer is correct, but it will change Pulse Audio settings only. This is how sound works on Linux:

App > Pulse Audio > ALSA > actual soundcard

  • Apps can do their own audio processing, although it's uncommon.
  • Pulse certainly does its own audio processings.
  • The later can also be said about ALSA.

So, changing Pulse Audio sample format and sample rate is just the FIRST step to be taken. You have to properly set up ALSA.

Now, I can't tell you how to do that. Not a single recent Ubuntu release allows you to change ALSA settings via configuration files. Apparently, ALSA will always resample everything to 48KHz/16bit and you're stuck to it. I must remind you that ALSA mixing and resampling algorithms are of very, very, low quality, similar to XP's KMixer.

That means: until someone makes it possible to change ALSA sample format and sample frequency on recent (2012/2013) Ubuntu distros, as you can change Pulse's, audio on Linux just SUCKS like hell!

Also, don't set sample rate to "maximum option available", that will do audio resampling and you don't want that! Set sampling rate according to what you hear. If a CD audio: 44.1KHz. If DVD: 48KHz. Bit depth instead should always be the highest available, whereas 24bit seems to be the highest the best cards can handle.

I recommend my YouTube video for more information. You can extract from it what's more useful for you.

Eliah Kagan
  • 117,780
Paulo Henrique
  • 179
  • 1
  • 3
5

In addition to the answer from Scott Stensland, which advises to edit the configuration file for the pulseaudio server, I also had to delete all of the files in ~/.config/pulse.

Source: Linux Mint Forums

Nmath
  • 12,333
Marco
  • 51
  • 1
  • 2
  • Guys, don't ignore this advice, it is 100% required. You must delete the files in that folder so that pulseaudio is forced to regenerate database files. – jparanich Aug 25 '22 at 19:12