Skip to content

Instantly share code, notes, and snippets.

@bendilley
Last active November 20, 2015 21:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bendilley/074dcd5c85968b028c18 to your computer and use it in GitHub Desktop.
Save bendilley/074dcd5c85968b028c18 to your computer and use it in GitHub Desktop.
Raspberry Pi with Meridian Explorer setup

After installing mopidy via their apt source and setting it to run as a service, local file scans need to be run as the mopidy user, i.e.

sudo -u mopidy mopidy local scan

Also needed to sudo apt-get install gstreamer0.10-plugins-bad so AAC m4a files would be recognised, and ALAC m4a files needed gstreamer0.10-ffmpeg.

To get a Naim DAC-V1 working I had to lower the latency significantly to get it to work right:

[audio]
output = alsasink latency-time=1000

Also found these filename exclusions to be handy (coz I have them mixed in with my audio files):

[local]
excluded_file_extensions = .m3u,.cue,.pdf,.torrent,.nra,.yaml

Raspberry Pi Meridian Explorer setup

Update firmware using rpi-update and software using apt-get dist-upgrade

Disable onboard sound by commenting it out in /etc/modules

In /etc/modprobe.d/alsa-base.conf comment-out the line

options snd-usb-audio index=-2

Create /etc/asound.conf with:

pcm.!default {
  type plug
  slave {
    pcm "hw:0"
    channels 2
  }
}

Add yourself to the audio group; log out and back in again.

Checks:

ben@raspberrypi ~ $ lsusb -t
1-1.5:1.2: No such file or directory
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M
        |__ Port 5: Dev 4, If 0, Class=audio, Driver=snd-usb-audio, 480M
        |__ Port 5: Dev 4, If 1, Class=audio, Driver=snd-usb-audio, 480M
        |__ Port 5: Dev 4, If 2, Class=app., Driver=, 480M
ben@raspberrypi ~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: DAC [Meridian Explorer USB DAC], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
ben@raspberrypi ~ $ aplay /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
ben@raspberrypi ~ $

Volume controls:

amixer cget numid=2 # show acceptable values (0-60 for Meridian Explorer)
amixer cset numid=2 -- 25 # set volume to 25

Performance:

The most important fix:

Add the parameter smsc95xx.turbo_mode=N to /boot/cmdline.txt - this prevents ethernet bursts messing with the USB bandwidth. For me, this prevents clicks and pops when streaming high-res audio.

Optionally:

Use raspi-config to set the overclocking to 'High' (don't go over core freq of 250 GHz), then permanantly set the scaling governer to 'performance':

  1. sudo apt-get install cpufrequtils sysfsutils
  2. add this line to /etc/sysfs.conf
    devices/system/cpu/cpu0/cpufreq/scaling_governor = performance
    

Shairport is an easy way to turn the Pi into an (audio-only) AirPlay device. Following the README gets you as far as testing that it works. To set it up as a service:

sudo make install
sudo cp scripts/debian/init.d/shairport /etc/init.d
sudo cp scripts/debian/default/shairport /etc/default
sudo chmod +x /etc/init.d/shairport
sudo useradd -g audio shairport
sudo update-rc.d shairport defaults # you may not want this unless you want to dedicate the audio device to airplay duty

# Fire-up the AirPlay
sudo service shairport start

Set these values in /etc/default/shairport to use the hardware (headphone) volume control on a Meridian Explorer:

OUTPUT=alsa
CONTROL_NAME='Meridian Clock Selector'
OUTPUT_OPTS='-t hardware -c "$CONTROL_NAME"'

Actually, that didn't work either, so I had to hard-code the output options directly into the init file, as below.

    start-stop-daemon --start --quiet \
        --pidfile $PIDFILE \
        --exec $DAEMON \
        --chuid $USER:$GROUP \
        --nicelevel $NICE \
        -- $DAEMON_ARGS \ # minus $OUTPUT_OPTS
        -- -t hardware -c "$CONTROL_NAME"
@bendilley
Copy link
Author

Note to self, try tweaking fstab a la

fstype=cifs,ro,iocharset=utf8,sec=ntlmv2,rsize=2048,cache=strict,username=pi,password=raspberry

from this article

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment