How To: Enable High Quality Audio in Linux

My wife got me a FiiO E17 USB headphone amp (thanks, hon!) to go with my Sennheiser HD650’s the other day, and it can handle 96KHz 24-bit audio – but by default pulseaudio and alsa are configured for 44.1KHz 16-bit audio. At the 44.1/16-bit settings everything sounds great, but I figure if the quality can go higher and I’m not fussy about a bit of extra CPU usage then I may as well bump the quality settings up a bit to take full advantage. Here’s how to do it:

1 – Check current settings

To see what your current settings are, you can either run the following for the full details:

pacmd list-sinks

Or to cut to the sample rates directly use:

pacmd list-sinks | grep sample

Depending on how many sound devices are connected you should see something like this (in my example I have an Intel HDA internal soundcard as the first sink, and HDMI audio out as the second sink):

$ pacmd list-sinks | grep sample
	sample spec: s16le 2ch 41000Hz
	sample spec: s16le 2ch 41000Hz

You might want to play an mp3 at this point and then look at the pulseaudio cpu usage via the top command so you can compare the current and HQ CPU usage as it might be a factor for you (i.e. depending on the spec of your PC, you might not want to sacrifice 10% or more CPU usage for higher quality audio – but seeing as you’re here and reading this I’ll assume that you are!). As a baseline, with the default settings pulseaudio uses around 2-3% CPU to play an mp3 on my Intel i7.

2 – Modify for high quality

Pulseaudio’s global settings are stored in /etc/pulse/daemon.conf, so edit that with your editor of choice and look for the following lines (the ‘resample-method’ line is above the default-sample-* lines btw – that is, they’re not all together as below):

; resample-method = speex-float-1
; default-sample-format = s16le
; default-sample-rate = 44100

These are the defaults, and are currently commented out (you can use either ; or # to indicate a comment). Uncomment each line and modify it to the below (or even better – just add an uncommented line below each one so you can still see the default values), so you end up with:

resample-method = src-sinc-medium-quality
default-sample-format = s24le
default-sample-rate = 96000

The Arch Audiophile Playback wiki recommends medium quality for resampling, you might want to try src-sinc-best-quality if you’re going for broke. A description of the libsamplerate resampling methods can be found here if you’re interested:

I get about 10% CPU usage on the pulseaudio daemon with 96KHz @ 24-bit audio with medium quality resampling as above, whilst using src-sinc-best-quality results in a rather significant 24% CPU usage just to play an mp3! ( It’s like having a Pentium 100MHz all over again! ;-) ) The ‘s24le’ means 24-bit samples, little-endian order, btw.

3 – Restart pulseaudio and check the settings

Now that’s done we need to restart the pulseaudio daemon (don’t run these as sudo – pulseaudio runs per user so just execute as normal!):

pulseaudio -k
pulseaudio --start

Once that’s done, you should be able to check the settings have taken by issuing:

$ pacmd list-sinks | grep sample
	sample spec: s32le 2ch 96000Hz
	sample spec: s32le 2ch 96000Hz

It’s jumped up to 32-bit samples in this case, but that’s fine. Check the audio still works, and maybe have a look at the CPU usage when playing an mp3 via top again if you want to see how much this is affecting the CPU usage on your machine.

FiiO E17 Amp Check

Now that we’ve set higher quality default settings, if you’ve got some suitable hardware for them like the above-mentioned amp, plug that bad-boy in, switch it on – and it should validate that it’s getting the higher sample-rate and sample-depth:

$ pacmd list-sinks | grep sample
	sample spec: s32le 2ch 96000Hz
	sample spec: s32le 2ch 96000Hz
	sample spec: s24le 2ch 96000Hz   <--- FiiO E17 detected, working at 96KHz 24-bit
Fiio E17 at 96KHz 24-bit via pulseaudio
Fiio E17 at 96KHz 24-bit via pulseaudio via USB (i.e. it’s acting as a sound card). The ’40’ value is just the current volume setting.

Sound Quality Differences

So – does changing these audio setting make a definite, perceivable difference to the audio quality? The short answer is yes!

How much it changes the audio quality is going to depend on your hardware (amp, headphones etc.) as well as the actual audio file(s) you’re playing on it. I don’t have any 24-bit audio to try it out on, but I rip everything at the highest possible quality VBR mp3s using lame – so I’ve been testing on the first track of Alt-J’s album (intro) with some Sennheiser HD650’s – and my honest answer? I’d go as far as to say it’s a strong yes (html joke ;-)). The high-frequency elements in particular seem a little brighter with the 96KHz 24-bit sampling, at least when run through the FiiO E17. Now, this could be placebo – that is, you expect something to sound different/react in a particular way so you look for it and (internally, subconciously) try to convince yourself of it. But I’ve honestly swapped back and forth and listed to the same track a number of times during the writing of this article and I genuinely believe it’s sounding better with the HQ settings.

Unfortunately, the schoolboy error I’ve made here is that I’ve changed two (if not three!) things at once: I’ve enabled the higher sampling-rate and sample-size/depth, but I’ve also modified the resampling algorithm to one of higher quality at the same time – so figuring out what elements of the audio sound better because of the audio settings and which are from the resampling-method (because I’m not playing native 96KHz @ 24-bit audio files to test with) can’t really be done. To get any real results I’d need to strip back to default settings and modify each in turn, doing listening tests with notes as I go, which frankly isn’t all that high up there on my priority list of things to do because…


…I’m delighted with the audio quality after these changes! It really does sound great =D

Ideally, I’d prefer to have things set to 44.1KHz on each audio device EXCEPT the Fiio – that way, when I’m playing games there’s minimal CPU used on the audio side (which isn’t really going to benefit that much from upsampling and such, I’d imagine) and then have the HQ settings for the FiiO only so that when I plug it to listen to music I get the HQ audiophile kick. However, my understanding is that I’d need to go into the alsa side of things to configure device specific settings – and again, it’s not really a high priority at the moment.

I’d love to hear what difference (or lack thereof!) any of you find when changing over to HQ audio (asides from the bump in CPU usage) – and if you run or have played with different samplerate/re-sample settings for diff devices I’d be especially interested! Cheers!

34 thoughts on “How To: Enable High Quality Audio in Linux”

  1. Hardware amp and Linux tweak looks cool mate.

    Sound defaults are 44Khz/16bit because that’s what the Audio CD standard is
    Human hearing range is 20Hz to 20Khz (give or take) and higher frequencies degrade with age, by 40 you’re lucky to hear the full spectrum up to 17Khz

    So theoretically CD quality is all we’ll ever need, however vynil records are deemed more warm for the subsonic frequencies we feel rather than hear so extending the range is not necessarily a bad thing.
    However, not many pro studios yet record at 96Khz/32bit, most are still at 48Khz/24bit so the sweet spot for CPU usage may be around there for the time being.

    Considering the human hearing range I can’t see why it would ever extend to 96Khz for the consumer market to be honest.

    Great write-up, hope to see more soon

    1. The most significant benefits to higher bit depth is related to effects processing. There is a lot of subtlety that is lost when effects are applied at the minimum level of sound quality (CD quality).

      1. whoa! i finally got these settings into my computer and discovered that the onboard card is 32 bit capable! sweet. can’t wait to see how these synths sound. thanks a ton.

    2. My friend, the 48 khz here is referring to sampling, not to frequency response, it is totally another things!!!

  2. After a little more thinking and reading on this subject it’s likely your increase in sound fidelity is caused by increasing your bit depth and your ADC adapting your signal in a much better method than available on your computer.

    Looks like you already know which ADC to get…

    A really nice read on bit depth…

    I’ve been doing a little more reading around this and found this link interesting, if a little tech heavy…

    So why 44.1Khz for CDs?
    The Nyquist Theorem :)

    Sorry for the blurb, audiophile in the making!

  3. Hi,

    For you and others how want to achieve (real) high quality sound from their Linux computer with a USB DAC like the FIIO, I would recommend trying alsa together with mpd, instead of pulseaudio (with any other music playing software).

    I wrote the article “mpd-configure: automatically turn Linux into an audiophile music player” together with a helper script to get you going quickly and rather easy.

    The only “downside” is that the proposed setup does not do any reformatting or resampling of the audio source files. That means that the source files should not be in a format your DAC does not support, anything up to 24bit/96kHz in your case. But when you play (supported) high quality FLAC files though this setup and your audio hardware, I guess your in for a real treat.


  4. thanks,

    allthough i dont have a fiio, this helped me a lot to get my cambridge audio dacMagic plus handling hi-res flac files


    1. Nice. I’m looking for a second headphone amp so I don’t have to take the FiiO back and forth to work – would you like to comment on the Cambridge Audio DacMagic Plus?

      1. Hi,

        the dac magic is some rock solid piece of audio equipment. I like that it can handle a lot of inputs like spdif or xlr. Although I manly use it as a dac and headphone amp with my AKG k712. I like a very clear analytic sound. And that’s what the dacMagic (a specially in combination with the AKGs) delivers. If you like heavy bassboost, that’s definitely the wrong setup.

        Is it worth the money. I am not 100% convinced. I got mine as a special deal for less than 350 Euros (which is about 380$).

        Before the dacMagic i used the audioengine d1 which costs about 140 Euros and can handle up to 24bit/96kHz delivers also a very good quality warmer sound. I dont know how much money you would like to spend. If youre looking vor a Dac/amp in the 100-150$ Range the audioengine is worth concidering. If you like to spend more money and prefer a more analytic more audiophile sound the dacMagic is the way to go.

        I am not able to hear any Difference between 96 and 192kHz so for me that upgrade isn’t worth it. And i have to admit that on some days the sound of the dac magic is to analytic with to little bass (even if i change the preferences) and i prefer the warmer sound of the audioengine. And i am really not a Bass-Junky. Btw that’s why i stick to AKGs open Headphones and their sound. (and they are produced in my neighbourhood just a few blocks away – but that has nothing to do with the sound.)

        Greetings from Vienna

        1. Thanks for your reply =D

          The Dacmagic plus is a little more than I wanted to spend as I’m not seeing it for much under $600AUD. The Audioengine D1 seems pretty good, but I’ve decided in the end to go with an Audioquest Dragonfly v1.2 which I’ll be using with some Bowers & Wilkins P7s.

          I didn’t think I was particularly into bass and tend to prefer a crisp, bright sound overall – but after using the P7s (closed back) recently they sound a lot punchier / energetic than my Sennheiser HD650s (open back). I found that I quite liked that, so now I find myself dialing up the bass on the FiiO when using the HD650s.

          Cheers & happy listening!

  5. Hey r3dux, thanks for this article, I am now enjoying really good quality audio in manjaro and mint!

    I created a very basic script (as a result of finding this article) to switch between low and high quality settings on the fly, to help me find the best settings quicker, and to be able to revert to less cpu intensive settings when it didn’t matter.

    Check it out at:
    as I said, it is very basic and probably ‘incorrect’, but it works well enough for me.

    1. That’s really cool – what a good idea! I just comment/uncomment and then forget how to restart PA etc ;-)

      The only possible way I see this breaking something is if newer versions of pulseaudio modify the legal config (new switches? options changed?) – that is you have your version, then the new version comes with an update, then you change quality and copy the old version over the (just updated) original. You could possibly get around this by copying the CURRENT daemon.conf to something like daemon.conf.setaudio before applying any change, because any change that errors will immediately show the error and the user can roll back?

      Or (as you say) a find-and-replace would be a better option (with a “//Commented out by setaudio on move to HQ” or “//Commented … LQ” perhaps, just in case?) – as it stands, this is a great idea – so good job, fella!

      Would love to see it as a awk/sed modifier if you have the time someday! =D

    1. You are absolutely spot-on for calling me on this, and you may even be right.

      As it’s obvious that a 44.1Khz/16-bit audio track cannot have more detail added to it via upsampling and moving to 24-bit, I think it was the change in interpolation quality that was increasing the fidelity of the audio (pulseaudio default is: speex-float-3?). So perhaps this article was misleading, but I have no real way of knowing.

      I have absolutely no reason to lie to you, unless that would be to deceive myself also – but I genuinely listened to the same track multiple times with various settings and found/believed that it sounded better with the HQ settings. Whether this would pass a double-blind test I don’t know.

      I note that the article you linked to does include discussion of the Nyquist theorem, and both looks and ‘smells’ very legit – however I can only report on what I experienced.

      Would love to hear anything further about interpolation quality that you might have been able to notice.

      Note: In all fairness, I do point out that I’ve changed multiple things and that I can’t pinpoint the perceived increase in quality to one specific element in the article.

      1. Okay, that’s a very, very good article. Tremendous, in fact.

        But I will stand by everything I’ve said, because I’m not (consciously) trying to deceive or manipulate you in any way, shape or form – I just wrote it as I tested it.

        Thanks for the feedback – it’s certainly food for thought.

        1. I think the most important setting is the resampling quality. To get a proper resampling, the signal should be supersampled first I believe, so maybe that’s what the middle-best settings do.

    2. I lost interest in reading this article when I realised the writer assumes that the ‘192’khz in ‘192’khz audio files relates to the spectrum of the music. I think that is utterly stupid. No one listens to 24/192 so they can hear higher frequencies, that would be ridiculous. instead, it is called the ‘sampling rate’, which the writer doesn’t seem to acknowledge. So the entire section about the mechanics of our ears, or our inability to perceive xray/infrared light is pointless. This also makes me wonder why the writer decided to bang on about how 192khz audio (remember, sampling rate actually) causes more distortion if we try to push 192khz frequencies through our amplifier/speakers.(again, that’s not the point of 192khz sampling rates in the first place..) But I would just point out that audio is recorded and mixed at that high rate, and studios don’t seem to have a problem with phantom ultrasonic distortions, and they don’t have specially engineered amplifiers or drivers to playback ultrasonic sounds, mainly because they never recorded such high frequency sounds in the first place.

      I understand that 44khz perfectly represents the analog waveform mathematically, but then, so does a 22khz signal. And there is quite obviously a perceivable difference there, even in mid tones. I’m not saying I’m one of those special few who can tell the difference between 44khz or 192khz, sometimes I like to think I can but more importantly, if I know the audio is HD, it sounds better to me. Call it placebo, but music is about perception and I only care about mine. On the other hand, I sure as anything can tell the difference between 16/24bit audio. The difference is like night and day, and I think we can all grow up now and adopt 24bit audio, the sampling rate is debatable, sure, but it depends on the quality of your equipment much more than the size of your hard drive.

      As for up sampling 16/44 audio to anything higher, yeah that doesn’t really make any sense, which is why I’m grateful for the artists that do release 24/96 tracks, which do sound better on even average equipment.

  6. Hi!
    Great article.
    I configured PulseAudio to use the 96kHz sample rate. But I have no external DAC. Is there any way to check what my soundcard supports? I would magine that the soundcard has it’s own DAC to convert from digital to analog. If the card itself would use 44.1kHZ then my PulseAudio configuration wouldn’t make any difference.

    So, any idea how I can check the actual settings of the soundcard?


    1. /proc/asound directory contains information about soundcards.
      In my case /proc/asound/card0/codec#0 :
      Codec: Realtek ALC887-VD

      Default PCM:
      rates [0x5f0]: 32000 44100 48000 88200 96000 192000
      bits [0xe]: 16 20 24
      formats [0x1]: PCM

      1. The file to monitor what samplerate and bitdepth your sound card in conjunction with alsa actually uses, depends on the device.

        To make the process of identifying that file a bit easier you may run the following from the within a terminal:

        “` ` “`
        bash <(wget -q -O – ";)
        ` ` `
        The line starting with "monitor file" displays the path. Open it using cat "/path/to/filefilename".

        See my article “Alsa-capabilities shows which digital audio formats your USB DA-converter supports” for more information.


  7. > The high-frequency elements in particular seem a little brighter with the 96KHz 24-bit sampling

    That sounds like a distortion that is induced by clipping during resampling the original 44.1 kHz material to 96 kHz. If there are intersample peaks in the original signal (they occur when the material is normalized to 0 dBFS, as a result of ‘loudness wars’), the resampler will likely produce values that are out of the integer range, and this will result in clipping. I haven’t met a single resampler yet that would provide enough headroom for this not to happen.

    The basic advice is to always match sampling rates of your source material and the DAC.

    1. That’s good advice. And I know what you mean by the the 0db loudness wars (i.e. normalisation to 0db)…

      …however, wouldn’t inter-sample peaks in the original signal simply be missed because… well, they’re inter-sample?

      I don’t see how they’d produce values out of the integer range, although I think I can fathom why you’d use integers instead of floats (because while floats have a larger range – their accuracy suffers because there’s a compromise between the bits allocated to the mantissa and the exponent).

      Anyways, I’m sure you’re right and I don’t want to get into a bun-fight over it – and matching the sample rate to the source material is definitely the best option. But if you wanted to explain I’d love to know how you came to your conclusion… =D

  8. I just implemented your suggestions on my own E17 and laptop running Ubuntu 17. Works great. I very much appreciate you taking the time to share your knowledge in such a carefully described way.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.