Using the TauDAC with Volumio

This post is obsolete – the TauDAC is offcially supported by Volumio since version 2.285 (07-10-2017)

If you want to use the TauDAC with Volumio, setting it up is straightforward. Download and install the latest Volumio image (required version >= 2.201), login to your Raspberry Pi and follow the steps below.

  1. Install the build dependencies:
    sudo apt-get update
    sudo apt-get install dkms build-essential bc
  2. Download the kernel source code:
    sudo volumio kernelsource
  3. Download and unpack the TauDAC driver source code:
    wget https://github.com/taudac/taudac-driver-dkms/archive/taudac-2.0.0.tar.gz
    tar -xzf taudac-2.0.0.tar.gz
  4. We will use DKMS to build and install the driver module. Move the driver source to a directory where DKMS can find it:
    sudo mv taudac-driver-dkms-taudac-2.0.0 /usr/src/taudac-2.0.0
  5. Build and install the driver:
    sudo dkms install -m taudac -v 2.0.0 --force
  6. Patch the Volumio dacs.json file to add the TauDAC to the I2S DACs list.
    cd /volumio/
    wget https://gist.githubusercontent.com/taudac/aacc79273a7a415a0c2e6abbcf08ce86/raw/d06485be20852f9060e8fd07b481fab1275cb4ad/0001-i2s_dacs-Add-TauDAC-DM101.patch
    git -c user.name='Your Name' -c user.email='your@email' am 0001-i2s_dacs-Add-TauDAC-DM101.patch
  7. Navigate to volumio.local, go to Settings -> Playback Options. Enable I2S DAC. Select ‘TauDAC – DM101’ and click save. Double-check the Volume Options, make sure ‘Mixer Type’ and ‘Mixer Control Name’ are set to ‘None’
  8. Reboot and enjoy your music!

Configuring MPD to use the TauDAC as audio output

Below is a configuration file for MPD, it configures the TauDAC as audio output and is optimized for bit perfect playback. You can specify the path to this file on the command line, or save it in a location where MPD can find it, for example at /etc/mpd.conf. See the mpd.conf manpage for further details.

# mpd configuration file for the TauDAC

## audio outputs
audio_output {
        type          "alsa"
        name          "TauDAC"
        device        "hw:0,0"
        auto_resample "no"
        auto_format   "no"
        auto_channels "no"
        mixer_type    "none"
        replaygain    "off"
        use_mmap      "yes"
}

## paths
music_directory       "/home/pi/music"
playlist_directory    "/home/pi/playlists"
db_file               "/home/pi/.config/mpd/tag_cache"
pid_file              "/home/pi/.config/mpd/pid"
state_file            "/home/pi/.config/mpd/state"
sticker_file          "/home/pi/.config/mpd/sticker"
log_file              "syslog"

## general
user                  "pi"
filesystem_charset    "UTF-8"
id3v1_encoding        "UTF-8"
log_level             "default"
auto_update           "yes"
auto_update_depth     "0"

## network
bind_to_address       "0.0.0.0"
port                  "6600"

Adopt the paths to your needs, or create the required directories as follows:

mkdir /home/pi/music mkdir /home/pi/playlists mkdir -p /home/pi/.config/mpd

References

  1. MPD Configuration Documentation
  2. mpd-configure: a script that creates configuration files for MPD

Building MPD from source

At the time of writing, the current MPD version in Raspbian Jessie is 0.19.1-1.1 (released in 2014), that’s quite old. If you want to have the latest version, this short tutorial describes how to build it from source. Another reason for building MDP from source, instead of using the Raspbian package, is: we can select the features we need and disable the stuff we don’t need, to get a smaller and (hopefully) more performant program.

First, download the latest release tarball from the MPD home page (the version number 0.19.19 is used as an example here):

wget https://www.musicpd.org/download/mpd/0.19/mpd-0.19.19.tar.xz

and extract it:

tar xf mpd-0.19.19.tar.xz
cd mpd-0.19.19/

Next, we need to install the required libraries and build tools:

sudo apt-get install g++ libboost-dev libicu-dev libglib2.0-dev

Depending on the desired MPD configuration some other installations might be required, for example:

sudo apt-get install libsqlite3-dev libmpdclient-dev libexpat1-dev \
  libid3tag0-dev libflac-dev libaudiofile-dev libmad0-dev libmp3lame-dev \
  libasound2-dev libcurl4-gnutls-dev libsystemd-daemon-dev

Now we are going to configure the compilation and, for example, disable some fancy but unneeded features (personal opinion) like re-sampling or audio CD support:

./configure \
  --enable-werror --prefix=/usr --sysconfdir=/etc \
  --with-systemdsystemunitdir=/etc/systemd/system --enable-systemd-daemon \
  --enable-database --enable-sqlite --enable-libmpdclient --enable-expat --enable-syslog \
  --enable-alsa --disable-oss --enable-icu --enable-glib \
  --enable-flac --enable-audiofile --enable-dsd --enable-mad --enable-id3 --enable-curl \
  --enable-mms=no --enable-smbclient=no --enable-nfs=no --enable-zlib=no --enable-bzip2=no \
  --enable-roar=no --enable-ao=no --enable-vorbis=no --enable-wavpack=no --enable-gme=no \
  --enable-lame-encoder=no --enable-shine-encoder=no \
  --enable-twolame-encoder=no --enable-vorbis-encoder=no --enable-wave-encoder=no \
  --enable-modplug=no --enable-mpc=no --enable-mpg123=no --enable-openal=no \
  --enable-opus=no --enable-sidplay=no --enable-shout=no --enable-adplug=no \
  --enable-sndfile=no --enable-wildmidi=no --enable-soundcloud=no --enable-ffmpeg=no \
  --enable-jack=no --enable-pulse=no --enable-lsr=no --enable-soxr=no --enable-fluidsynth=no \
  --enable-cdio-paranoia=no \
  --enable-recorder-output=no --enable-httpd-output=no --enable-solaris-output=no \
  --enable-libwrap=no --enable-upnp=no --enable-neighbor-plugins=no --with-zeroconf=no \
  --disable-aac

Check the output for errors and warnings. See .\configure --help for details about available options. If the script completes successfully, you should see an output like this:

File format support:
	(-AAC) (-AdPlug) (+DSD) (-C64 SID) (-FFMPEG) (+FLAC) (-FluidSynth) (-GME) 
	(-libsndfile) (-MikMod) (-MODPLUG) (+MAD) (-MPG123) (-Musepack) 
	(-Opus) (-OggTremor) (-OggVorbis) (+WAVE) (-WavPack) (-WildMidi)

A ‘+‘-character means that the corresponding option is enabled, a ‘-‘-character means that the corresponding option is disabled. Here, for example, the support for flac-files is enabled, while the support for opus-files is disabled.

Finally, compile the program:

make

and install it:

sudo make install

References

  1. MPD Installation Documentation

Mounting NFS directories using AutoFS

AutoFS allows to automatically mount network shares on demand. Compared with traditional fstab configurations, using AutoFS has the following benefits.

  • With AutoFS, directories are automatically mounted when they are accessed and are unmounted after a period of inactivity — can reduce boot time and improve overall performance.
  • Auto-mounting via fstab will fail if the network connection to the network share is not yet established during boot time (common issue with WiFi netwoks) —  not an issue with AutoFS, as the shares are mounted on demand.

However, mounting a NFS directory using AutoFS requires a little more work, compared to adding a rule to the /etc/fstab file, here is an example.

Install dependencies:

sudo apt-get install autofs5

Create a mount point:

sudo mkdir /nfs

Configure the mount point, add the following line to the end of the file /etc/auto.master:

/nfs /etc/auto.nfs --ghost

Note: That line tells the AutoFS service that the mount points under /nfs are configured in file /etc/auto.nfs.

Add the following line to the file /etc/auto.nfs (create the file if it does not exist and adopt the hostname of the NAS and the name of the NFS directory):

music -fstype=nfs,ro,noacl,noatime,nodiratime,noac,tcp mynas:/volume1/music

Note: In the example above, the NFS share is mounted read-only, with some flags to optimize performance. Adopt the NFS mounting options to your needs, if necessary.

Restart the AutoFS service:

sudo systemctl restart autofs

External Links

  1. Ubuntu AutoFS Documentation
  2. Red Hat Enterprise Linux 7 AutoFS Documentation