cute70.jpg
CuteStudio Ltd.

SeeDeClip4 headless slave

Img_Pi_Slave.jpg


Turn your Raspberry Pi (or other Linux box) into a 24bit HiFi source! (Click on the image for information).
This is Linux only, not OS/X.

Raspbian can support a headless slave that uses the direct ALSA 'aplay' utility to render the audio. This bypasses HTML5 and allows the full 24bit sound to be played to your DAC hooked up to the linux box.

Headless merely means there is no need for a screen or keyboard, just the Raspberry Pi (ideally mounted in a box) can be positioned next to your HiFi and either feed your DAC directly via USB or electrically isolated with a USB/Optical adapter. Any adapter capable of 24bit should be good for the job, the key aim here is to preserve detail and using 16bit here will lose some: it needs to be 24bit.

Task summary

  1. Download runslave.sh from SeeDeClip4's home page with your browser.
  2. Permissions:
    chmod +x runslave.sh

  3. Edit it for your system and requirements (see below).
  4. Run it on your headless audio slave:
    ./runslave.sh


1. Download/Install

You will need to download the runslave.sh shell script from the home page of the SeeDeClip4 you have installed, copy it to the raspberry Pi (or other linux machine).

You can do this using the command line if you like, for instance if SeeDeClip4 is running on 198.168.0.10:
wget 198.168.0.10:8000/runslave.sh -O runslave.sh

if you get 'command not found' you may need to install wget first:
sudo apt-get update
sudo apt-get install wget


2. Permissions

To allow it to run on the Pi:
Type
chmod +x runslave.sh


3. Edit/Configure

The file runslave.sh is designed to be fairly stable and will not be updated very often. You can edit this file to specify the bitrates, depth, card number etc. so the default settings become your own settings.

This is the section in runslave.sh that you can edit:

server=localhost    # Where SeeDeClip4 is running.
server_port=8000
alsacard=1          # Use "aplay -l" to list the soundcard options. USB will usually be 1.
bits=16             # Some USB devices do not work with 24 bit will work with 32.
rate=1              # 1 is 1x, 2 is x2 for 44.1->88.2 and 48->96kHz


Type:
aplay -l

to list the soundcards.
This is aplay -L as in L for List, not the number 1. But use a small case L: l.

If you are using a USB sound card you'll probably need card number 1.

4. Run

Make sure that SeeDeClip4 is running on the same machine or network. If it's on the network you can type something like:

Then run it on the Pi like this:

./runslave.sh

or
./runslave.sh 192.168.0.108


If it wants to install standard audiotools you'll need to be connected to the internet and have sudo control the first time it's run.

You should now see it talking to the server. On the server (from a browser) go into the 'Remote' page and make sure the slave is selected at the top.
Play a track and check that the slave wakes up and you see a line starting with wget or aplay. If so you can now plug your DAC into the USB of the Raspberry Pi.

Auto-start

To make the slave startup automatically upon power-on is a matter of adding these lines to the /etc/rc.local startup file

Type
sudo nano /etc/rc.local


Add these lines
LOGFILE=/tmp/runslave_log.txt
(sleep 10 && sudo -u gpw /bin/bash /home/gpw/runslave.sh > $LOGFILE 2>&1) &


Then when the Pi is powered up it will run the runslave.sh script for you, as you. The output will be directed to /tmp/runslave_log.txt, which you can check by typing the following address.
tail -n25 /tmp/runslave_log.txt


Troubleshooting

Troubleshooting
I get 'permission denied' Type chmod +x runslave.sh to allow it to run.
Slave cannot be seen by the Remote pageCheck the server addres you pass to runslave.sh script is correct.
You can find the IP address of the server on the home page.
No sound and the music skips from track to track
Type:
dmesg
to see that your USB device in indeed there. If it is, you may need to select a different card using the command line.
Type (that's a lower case L, not minus one):
aplay -l
And you should see this:
Pi{10} aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: U2S [PHIREE U2S], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: U2S [PHIREE U2S], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
Pi{11}

By default runslave uses ALSA card number 1. To use 0 or 2 etc. edit runslave.sh to change 'alsacard'.
Sometimes a track fails
to restart when unpaused
This is an issue with aplay being interrupted, sometimes it's silent when it continues and needs to be re-paused and re-continued to get the sound out again.

So just wait a second, pause it again and wait a second, then unpause it and it should start.
Perhaps one day it will be more tolerant to being paused, there is no workaround for this problem as the silence is invisible to Linux.


Disabling swap

You may wish to disable the swap disc as it will probably use the very slow SDcard in there with the system on, and the writes could cause sound dropouts. To do this you type:

  • sudo swapoff -a
  • sudo update-rc.d -f dphys-swapfile remove
  • sudo rm /var/swap

Copyright © 2007-2019, CuteStudio Ltd.
Page generated in 0.071s, Powered by Silk V1.2-1 from Cutestudio