Any tips for achieving high quality audio playback?


#1

Dear friends

In my HiFi rack, I have a headless MacMini which I use for audio playback exclusively. In OS X, I use an audio player which I am very satifsfied with, but I’d like to switch this machine to Voidlinux as well :grinning:

The MacMini is connected via USB to an asynchronous D/A-converter.

I have been able to collect some general information in the Internet (see requirements and my solutions below). I would be very grateful if you could tell me if there’s anything else I could do to make the system even leaner, and whether I am generally on the right track.

Many thanks for any tips and for your patience!

Best regards


Installed:

  • void-musl
  • alsa-utils
  • mpd
  • ncmpcpp
  • ssh

System configuration (from Arch-Wiki):

/etc/default/grub
------
GRUB_CMDLINE_LINUX_DEFAULT="threadirqs"

cpufreq governor (from Arch-Wiki): How can I make this setting permanent in Voidlinux?

# cpupower frequency-set -g performance

swappiness and inotify (from Arch-Wiki):

/etc/sysctl.d/sysctl.conf
------
vm.swappiness = 10
fs.inotify.max_user_watches = 524288

Bit perfect audio playback and automatic sample rate switching:

/etc/mpd.conf
------
[...]
audio_output {
    type "alsa"
    [...]
    auto_resample "no"
    auto_channels "no"
    auto_format "no"
    replay_gain_handler "none"
    [...]
}

Avoid software induced jitter and other interferences:

  • Besides removing services from /var/service, are there any other ways to remove any unused services?
  • As I cant’t find a realtime kernel for Voidlinux, would you recommend compiling a custom kernel? I have never done anything like that, but perhaps it would be a good exercise anyway :sunglasses:

Load tracks before playback to reduce disk access:
This would mean installing Xorg and e.g. deaDBeef player (= full memory play, according to my informations). Would this configuration use less real-time resources than running mpd (= streaming), but no Xorg?


Bypass the software mixer:

/etc/mpd.conf
------
[...]
audio_output {
    type "alsa"
    [...]
    mixer_type "none"
    [...]

Are there any additional means to optimize and streamline the audio path, i.e. to achieve source direct in addition to bit perfect, as described in http://www.amr-audio.co.uk/large_image/MAC%20OSX%20audio%20players%20&%20Integer%20Mode.pdf?

Again, many thanks for any tips!


#2

Can’t you achieve this goal using the default settings in Void?
Don’t you get an “high quality audio playback” if you use mpd, deadbeef or any other audio player?


#3

My only relevant knowledge is to set the correct rate and dmix format for your DAC in alsa.conf.

For example, for my Bifrost I have

defaults.pcm.dmix.rate 192000
defaults.pcm.dmix.format "S24_3LE"
defaults.pcm.dmix.rate_converter "samplerate_best"

But I’m not sure that’s what you are looking for.

Are you sure you need all those modifications to have the sound you want?


#4

Regarding RT kernel you don’t really need one if your target is essentially playback and not tracking audio. Anyway, the Void kernels are preempt enabled which is usually a better compromise than a full RT kernel. They’re less tricky, more stable and usually working with proprietary drivers (if you go that route).

dmix is cool, but not good at resampling. To mix different sources together dmix needs to resample everything to 48K Hz, but It has a poor resampling algorithm. It’s better to use libsamplerate for the task (in the repos) adding something like this to ~/.asoundrc

defaults.pcm.rate_converter "samplerate_best"

libsamplerate (or any good realtime resampling tool) is quite CPU intensive. It’s better to have a relatively capable processor. Again, a preempt kernel should suffice for the purpose.

Better than just alsa and a bunch of plugins, the full blown route is using jack perhaps via Cadence (in the repos). It’s not a light in resources solution and perhaps a bit overkill, but it’s the best and more versatile audio setup I’ve found in Linux so far.


#5

@cr6: Yes, bit-perfect playback is achieved easily with the default settings in Void. But according to Damien Plisson’s paper mentioned in my original post and to https://www.ap-linux.com, further optimization might be possible, by means of achieving source direct and by disabling resource-intensive daemons, services and processes.

As Void appears to be a very lean system already, I’m not sure how much optimization potential is left :grinning: I’m going to find out, I hope :face_with_monocle:


@eichhorn, @snap: As I’m using that MacMini for audio playback exclusively (only one application at the same time), I think I don’t need neither dmix nor Jack.


Thanks a lot to all of you for having taken the time to give some hints! I think I’m definitely on the right track at the moment :grinning:

Best regards


#6

Daphile is made for that purpose.


(Edmond Dantes ) #7

perhaps I didn’t get the question right,but why not use a sound server?


(William Rueger) #8

A sound server, presumably pulseaudio, always wants to “process” the signal, instead of letting it pass through unchanged. Usually this means resampling it, or changing the bit-rate. This leads to loss of fidelity. To be fair, even a real audiophile would usually have trouble noticing the difference. But if, as an audiophile, you know the original “bits” of your source have been tampered with, it can alter your perception/enjoyment of the music. Pulseaudio did recently add a flag to discourage resampling of a source. You may try “avoid-resampling = true” in /etc/pulse/daemon.conf.


#9

I don’t know if this helps but I just found this link:

https://wiki.linuxaudio.org/wiki/system_configuration


#10

probably this will help also:


and if you are missed it:


#11

Daphile: “Headless music server OS … based on the open source Squeezebox Server”

No. Daphile: “Bitperfect and gapless playback”

There is no reason to fuss around unless the goal here is really to super-tune Void audio with endless tweaking. In that case use JACK and get it over with.


(Edmond Dantes ) #12

I’m with @nixit in this. I mean, one can obviously tweak a lot with asoundrc, optimize the driver kernel options to perfectly fit his/her speaker output, modify the udev rules to achieve a comfortable behavior, dig into the various applications man pages to potentially tune the per-app equilizer and sound options, etc…

but in the end, for a standard home media server, the best result in the shortest time possible is probably achieved just through a sound server + a media server program, and Daphile seems a really good one, though personally I’ve never used it

JACK probably doesn’t boast the same software support as Pulseaudio, but it’s way more powerful and slightly more lightweight than the former, aside from being a professional piece of software designed exactly for this kind of purpose. I’ve yet to try JACK2, which supposedly would be even better for a media server, and NAS

Is Daphile itself open source too? if yes what license is it released under?
currently I’m using minidlnad and MPD+httpd plugin but was looking something more serious


#13

I forgot to ask you @fabulvoidf , what kind of “audio” are you talking about?
I mean the source: do you listen Vinyl records, or CDs, or something else?
In the case of mp3 (what most people are listening nowadays), “high quality” means nothing, of course. :stuck_out_tongue:

JACK can be very useful in the context of a live session with multiple instruments / effects / drum machines, where very low latency is required.


#14

Built on Gentoo and Squeezebox, which is now FOSS. Also, non-commercial disclaimer on Daphile. Ask Daphile for details, I’m not the expert.

People mean the latest version of JACK when saying it. If worried boot KXStudio for a spin, it’s entirely JACK. JACK is back-end, so, as long as s/w has a drop-down menu for back-end, you’re good. “Explain like I’m five” article gives Pulse history. Again, refer to Daphile itself and audio forums everywhere for details. I am just saying others have the OP’s use case and even his hardware and use Daphile with good success.


(Edmond Dantes ) #15

I haven’t touched JACK in ~3 years; at the time, IIRC (and may be wrong), all repos included jack1 only and used to refer to it simply as ‘jack’, so I’m quite sure I’ve never used JACK2;). Either way, I was not into Linux yet, and my exoerience with jack came wirh freebsd. In the last few years I’ve developed a kind of minimalist taste which brought me to prefer sndio,bare ALSA,or even bare OSS


#16

According to system_configuration#the_kernel you don’t need it:

$ grep -e "CONFIG_IRQ_FORCED_THREADING=y" -e "CONFIG_PREEMPT=y" /boot/config-`uname -r`
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_PREEMPT=y

You can use /etc/rc.local to put this command. :wink:


Seems very high.
Void kernels are set to 8192 by default.
The highest value I have seen in other distros was 65536.


#17

Dear friends

Thanks al lot for your additional Input :grinning: I was away and could not look into the forum earlier.

@furryfixer:
But if, as an audiophile, you know the original “bits” of your source have been tampered with, it can alter your perception/enjoyment of the Music.

Exactly! Thanks for the neat description!

@shizonic, @palytch60:
Thanks for the links! I found the very same ones before reading the forum again. The links show that many of the recommended settings are default settings in Voidlinux :+1:

@cr6:
What kind of “audio” are you talking about?
I mean the source: do you listen Vinyl records, or CDs, or something else?

I listen to 44/16, 48/24 and 96/24 FLAC files, made from ripped CDs or from lossless originals. Vinyl as well, but I don’t need a computer for that :wink:

Best regards