LinkedIn Sourceforge Twitter

Vincent's Blog

Pleasure in the job puts perfection in the work (Aristote)

How OpenBSD find a place in my Hifi installation ?

Posted on 2016-07-26 21:14:00 from Vincent in OpenBSD Hifi

I will explain how OpenBSD has become the key element in my Hifi installation. Close to Keff speakers, Arcam amplifier and Cambridge Audio DAC, I've placed a small OpenBSD machine. Why ? How ? I'll explain it.

The beginning first

The story begins when I was looking for a solution to play my flac files on my Hifi installation.

Like most of the "old persons" (born in the 70'), I simply had a CD reader connected to my amplifier, then connected to my speakers. It's was a simple and easy setup to play CDs. But with the numeric world, I had less and less CDs and more and more flac files on my NAS server.

I can listen easily those files on my different computers, but now I want it to my Hifi.

Thus basically the idea is to have a DAC which will convert numeric signals to analog one. The DAC is the component between your computer and your analog amplifier. In my case it's a Cambridge Audio DacMagic plus. For sure I will connect it to an OpenBSD (like for most of my systems), for the same reasons: it's really simple to use and very flexible.


In this case I bought a ZOTAC ZBOX-ID18 because it has a numeric output port (SPDIF) and ethernet supported by OpenBSD.

The Box has 4GB of DDR3, 2 CPU intel celeron of 1.5GHz. It's not fanless, but he does very few noises. In fact we don't hear it.

The internet driver is re, and the audio driver is azalia with support of SPDIF

As for several of my other machines, I'll install a read only OpenBSD system. It's easy to setup, can run from an usb stick and I don't care about the shutdown process. (In fact, I don't care at all because I just cut the power)


On the software side, there is nothing !!!! Just OpenBSD with his smart tools.

In this case the famous smart tool is sndiod.

The genius feature of this small tool is because he is network compliant. This means that the you can have the player and the speakers on different machines.

The second software component is mpd.

I'm using it on my NAS (NFS server) and ask him to send the sound to my small Zotac box running side to my DAC.

This sounds maybe weird, but it's very simple to implement. You just have to configure 1 variable on the player side and "open" the connection of sndiod on the Zotac side.

Setup on mpd side

On the mpd side, you have to configure 1 variable: AUDIODEVICE before starting mpd

export AUDIODEVICE="snd@"

As you can guess, is the address of my Zotac machine.

It's dead simple, no ?

For mpd, you just have to configure the audio to "ao". The rest remains very common.

Here after my config for /etc/mpd.conf:

obsd-nas:~#grep  '^[^#]' /etc/mpd.conf         
music_directory                 "/mnt/sd1/share/music/current"
playlist_directory              "/var/spool/mpd/playlists"
db_file                         "/var/spool/mpd/mpd.db"
log_file                        "/var/log/mpd/mpd.log"
pid_file                        "/var/spool/mpd/"
state_file                      "/var/spool/mpd/mpdstate"
user                            "_mpd"
bind_to_address                 ""
input {
        plugin "curl"
audio_output {
        type                    "ao"
        name                    "Libao Audio Device"
        mixer_type              "software"

Setup on the Hifi side

You just have to start the sndiod with the following parameters: -L

# more /etc/rc.conf.local

In other words it says the sndiod accepts connection on all network connections. But I have only one on this machine!!

To be sure that the audio signals are going out via the SPDIF, you have to configure the mixerctl.conf file.

# more /etc/mixerctl.conf  

The setup is very simple and allow me to provide numerical flows to my DAC at a rate of 48Khz. Purist will say that 192Khz is better. But, except error on my side, the Zotac does not allow it.


The story should ends here, but unfortunately there is small weird problem. Indeed, when I shutdown my Zotac box, mpd becomes to have troubles (maybe because he does not found his audio speakers anymore). Thus when I restart the Zotac, I have to kill/restart the mpd daemon running on the NAS.

What I did to solve this? I've used the ssh public keys of the Zotac, so he can kill and restart the mpd (running on the NAS) him self when he boots:

# more /etc/rc.local   
/usr/bin/ssh root@ /root/

on the NAS I have such script:


pkill -9 mpd

Lessons learned

This setup runs since early 2015 without troubles. It was OpenBSD 5.8, now it runs 6.4.

The other nice thinks of this setup is coming from the flexibility of mpd. I have a client installed on my smartphone, so my smartphone becomes the remote control; I'm using MPDriod now renamed malp.

An another nice application is ympd. This is a web based client of mpd. Really cool and simple to use on tablet and even smartphone (so you don't need to install any applications)

117, 101
displayed: 7585

1. From Antoine on Sat Nov 10 12:16:03 2018

Très intéressant. Je vais m'en inspirer, pour faire mon truc à musique... Merci ! Antoine

What is the last letter of the word Moon?