Raspberry Pi - Behringer X-Touch mixer control surface at Console

Part 1: General setup

  • run raspberrypi-ua-netinst on SD card (default install - server packages of debian jessie)
  • SSH in as root…
passwd
> /etc/motd
echo rpi-mixer > /etc/hostname
sed -i s/pi/rpi-mixer/g /etc/hosts
echo "America/Chicago" > /etc/timezone
ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
sed -i -e 's/^# en_US.UTF-8/en_US.UTF-8/' /etc/locale.gen
dpkg-reconfigure -f noninteractive locales
apt-get --no-install-recommends install aptitude
aptitude install fbset screen rsync psmisc file patch ethtool strace tcpdump vim bzip2 xz-utils netcat-traditional
aptitude --without-recommends install dnsutils

aptitude install watchdog
sed -i -e 's/^#watchdog-device/watchdog-device/g' /etc/watchdog.conf
sed -i -e 's/^#max-load-1\t/max-load-1\t/g' /etc/watchdog.conf
echo "# Raspberry Pi doesn't work with the default timeout of 60; set it to 10 instead" >> /etc/watchdog.conf
echo $'watchdog-timeout\t= 10' >> /etc/watchdog.conf
systemctl enable watchdog.service
ln -sf /lib/systemd/system/watchdog.service /etc/systemd/system/multi-user.target.wants/ # nothing in the [Install] section for this unit file, so we symlink manually

adduser tdobes
adduser tdobes adm
adduser tdobes systemd-journal

# don't erase boot messages from console
mkdir -p /etc/systemd/system/getty\@tty1.service.d
echo '[Service]' > /etc/systemd/system/getty\@tty1.service.d/noclear.conf
echo 'TTYVTDisallocate=no' >> /etc/systemd/system/getty\@tty1.service.d/noclear.conf

# improve boot speed
systemctl mask keyboard-setup.service
systemctl mask console-setup.service
systemctl mask rc-local.service
systemctl mask kbd.service

systemctl disable rsyslog.service # disable to reduce writes to sd card
systemctl stop rsyslog.service
rm /var/log/auth.log* /var/log/daemon.log* /var/log/debug /var/log/kern.log* /var/log/messages /var/log/syslog

systemctl disable hwclock-save.service # avoids error on shutdown/reboot

Part 2: Network

aptitude install ifplugd
sed -i -e 's/^INTERFACES=""/INTERFACES="eth0"/g' /etc/default/ifplugd
sed -i -e 's/^allow-hotplug eth0/#allow-hotplug eth0/g' /etc/network/interfaces

# it looks like this uses systemd-timesyncd, so we won't use NTP

mkdir -p /etc/systemd/system/ssh.socket.d
echo '[Socket]' > /etc/systemd/system/ssh.socket.d/port-2222.conf
echo 'ListenStream=2222' >> /etc/systemd/system/ssh.socket.d/port-2222.conf
systemctl disable ssh.service && systemctl enable ssh.socket

systemctl mask networking.service # we use ifplugd instead
echo 'D /run/network 0755 root root' > /etc/tmpfiles.d/debian-networking.conf
echo 'F /run/network/ifstate 0644 root root - lo=lo' >> /etc/tmpfiles.d/debian-networking.conf

Part 3: Mixer and X-Touch

aptitude install python2.7 usbutils alsa-utils
aptitude install python-pip python2.7-dev libasound2-dev
pip2 install python-rtmidi

mkdir /opt/mixer
pushd /opt/mixer
### put code for mixer in /opt/mixer
chown tdobes /opt/mixer # for development

adduser tdobes audio

Part 4: MQTT

aptitude install mosquitto-clients python-mosquitto

Part 5: OSC and X32 Tools

aptitude install liblo-tools python-liblo pyliblo-utils

aptitude install unzip
mkdir -p /opt/mixer/x32_tools
pushd /opt/mixer/x32_tools
wget 'https://sites.google.com/site/patrickmaillot/docs/X32arm.zip?attredirects=0'
mv X32arm.zip\?attredirects\=0 X32arm.zip
wget 'https://sites.google.com/site/patrickmaillot/docs/X32_RPI.zip?attredirects=0'
mv X32_RPI.zip\?attredirects\=0 X32_RPI.zip
unzip X32arm.zip && unzip X32_RPI.zip && rm X32arm.zip X32_RPI.zip && chmod +x X*

Part 6: Autostart on USB hotplug

adduser --system --home /nonexistent --shell /bin/false --no-create-home --disabled-login mixer
adduser mixer audio

echo '[Unit]' > /etc/systemd/system/mixer\@.service
echo 'Description=MCP Mixer Control for %I' >> /etc/systemd/system/mixer\@.service
echo 'After=network.target' >> /etc/systemd/system/mixer\@.service
echo 'BindTo=%i.device' >> /etc/systemd/system/mixer\@.service
echo 'After=%i.device' >> /etc/systemd/system/mixer\@.service
echo >> /etc/systemd/system/mixer\@.service
echo '[Service]' >> /etc/systemd/system/mixer\@.service
echo 'ExecStart=/opt/mixer/mixer.py' >> /etc/systemd/system/mixer\@.service
echo 'WorkingDirectory=/opt/mixer' >> /etc/systemd/system/mixer\@.service
echo 'User=mixer' >> /etc/systemd/system/mixer\@.service
echo 'Environment=PYTHONUNBUFFERED=1' >> /etc/systemd/system/mixer\@.service
echo >> /etc/systemd/system/mixer\@.service
echo 'Restart=always' >> /etc/systemd/system/mixer\@.service
echo 'RestartSec=1' >> /etc/systemd/system/mixer\@.service
echo 'StartLimitInterval=10s' >> /etc/systemd/system/mixer\@.service
echo 'StartLimitBurst=10' >> /etc/systemd/system/mixer\@.service

echo 'SUBSYSTEM=="sound", KERNEL=="card*", SUBSYSTEMS=="usb", ACTION=="add", ATTRS{idVendor}=="1397", ATTRS{idProduct}=="00b2", TAG+="systemd", ENV{SYSTEMD_WANTS}="mixer@$env{DEVNAME}.service"' > /etc/udev/rules.d/mcp-mixer.rules
computer/raspberry_pi_mixer.txt · Last modified: 2019/03/06 13:00 by tdobes
Recent changes RSS feed Driven by DokuWiki Valid XHTML 1.0 Valid CSS