BlitzLoop can be installed on a Raspberry Pi, for what might possibly be the world's smallest and cheapest full-featured karaoke box.
Normally, BlitzLoop runs on OpenGL on GLX on Xorg, and uses mpv with the opengl-cb backend. The Raspberry Pi does not work efficiently with this setup. However, BlitzLoop also supports a native Raspberry Pi backend, which uses EGL directly without Xorg, and takes advantage of the hardware compositor to display karaoke lyrics on a layer above the video playback layer, provided by mpv's rpi backend. This guide focuses on this specific Raspberry Pi support.
- Raspberry Pi 3
- Arch Linux ARM
BlitzLoop has only been tested on a Raspberry Pi 3. Previous models may not be powerful enough to work properly. Feel free to try.
Follow the Arch Linux ARM installation guide for Raspberry Pi 3 (32bit version).
It is assumed that you are using the default alarm user to run BlitzLoop.
Additionally, you might want to change the password for alarm and/or root,
set up SSH keys, etc.
Make sure your Ethernet network is properly configured and you have internet access (Arch Linux ARM uses DHCP by default), at least during installation. We will be using WiFi as an AP for the client remote control devices to connect to; it is possible to configure WiFi as a client to an existing network, but that is beyond the scope of this guide.
This guide assumes that you have sudo installed and configured. If you don't,
run the commands prefixed with sudo as root (e.g. su).
cat <<EOF | sudo tee /boot/config.txt > /dev/null
gpu_mem=256
disable_overscan=1
dtparam=audio=on
EOFAlso set the CPU frequency scaling policy to performance (otherwise rendering
FPS will randomly vary):
cat <<EOF | sudo tee /etc/tmpfiles.d/10-fast-cpu.conf
w /sys/devices/system/cpu/cpufreq/policy0/scaling_governor - - - - performance
EOFReboot.
Set the locale to something with UTF-8:
echo 'en_US.UTF-8 UTF-8' | sudo tee /etc/locale.gen
sudo locale-gen
echo 'LANG=en_US.UTF-8' | sudo tee /etc/locale.confGrant alarm audio access and real-time priority for JACK:
sudo usermod -aG audio alarm
echo 'alarm - rtprio 99' | sudo tee -a /etc/security/limits.confLog out and back in.
sudo pacman -SyuWe need a bunch of dependencies from AUR, which will be a lot easier to do with yaourt:
# Manually pull in jack2 instead of jack, which works better here
sudo pacman -S --needed base-devel jack2 alsa-tools alsa-utils wget git
mkdir -p ~/pkg; cd ~/pkg
wget https://aur.archlinux.org/cgit/aur.git/snapshot/package-query.tar.gz
tar xvzf package-query.tar.gz
cd ~/pkg/package-query
MAKEFLAGS="-j4" makepkg --skippgpcheck --syncdeps
sudo pacman -U package-query-*.pkg.tar.xz
cd ~/pkg
wget https://aur.archlinux.org/cgit/aur.git/snapshot/yaourt.tar.gz
tar xvzf yaourt.tar.gz
cd ~/pkg/yaourt
MAKEFLAGS="-j4" makepkg --skippgpcheck --syncdeps
sudo pacman -U yaourt-*.pkg.tar.xz
cd ~/pkg
yaourt -S mpv-rpi
yaourt -S blitzloop-gitmkdir -p ~/.config/blitzloop
cat <<EOF >~/.config/blitzloop/blitzloop.conf
display=rpi
mpv-vo=rpi
EOFPut your songs in /home/alarm/.local/share/blitzloop/songs/ (create it first).
Run:
cd ~
blitzloop --mpv-ao=alsa --no-audioengineConnect to TCP port 10111 and check to see if everything works properly. Note that you will not have any microphone support at this point, as the Raspberry Pi has no audio input.
If you have no audio, you may need to run amixer cset numid=3 2.
cat >~/startblitz.sh <<EOF
#!/bin/sh
cd "\$(dirname "\$0")"
amixer cset numid=3 2
python -u /usr/bin/blitzloop --port=80 --no-audioengine --mpv-ao=alsa
EOF
chmod +x ~/startblitz.sh
cat <<EOF | sudo tee /etc/systemd/system/blitzloop.service > /dev/null
[Unit]
Description=BlitzLoop
[Service]
Type=simple
User=alarm
Group=alarm
ExecStart=/home/alarm/startblitz.sh
KillMode=mixed
TimeoutStopSec=5
AmbientCapabilities=CAP_NET_BIND_SERVICE
LimitRTPRIO=99
LimitMEMLOCK=1024000000
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl enable blitzloop
sudo systemctl start blitzloopTo get microphones supported, you will need to configure JACK. If you have a
single USB sound card you want to use for input/output, do something like this
in ~/startblitz.sh:
#!/bin/sh
cd "$(dirname "$0")"
export JACK_NO_AUDIO_RESERVATION=1
jackd -R --timeout 10000 -d alsa -D hw:AUDIO -r 48000 -p 240 -n 2 -o 2 &
jack_pid=$!
trap "kill $jack_pid" EXIT
sleep 1
python -u /usr/bin/blitzloop --port=80 --mpv-ao=jack --mics=system:capture_1,system:capture_2Where hw:1 is your desired audio device (you can look in /proc/asound/cards
for symbolic names you can use instead of index numbers which may change,
and use them as e.g. hw:AUDIO).
If you have separate cards for input/output (e.g. you want to use built-in or HDMI audio for output, or have a separate USB microphone and sound card), try something like this:
#!/bin/sh
cd "$(dirname "$0")"
export JACK_NO_AUDIO_RESERVATION=1
jackd -R --timeout 10000 -d alsa -P hw:AUDIO -r 48000 -p 240 -n 2 -o 2 &
jack_pid=$!
alsa_in -j mic -d hw:Receiver -c 2 -p 240 -n 2 -q 0 &
alsa_pid=$!
trap "kill $jack_pid $alsa_pid" EXIT
sleep 2
python -u /usr/bin/blitzloop --port=80 --mpv-ao=jack --mics=mic:capture_1,mic:capture_2 "$@"Set up a WiFi hotspot for tablets to connect to:
sudo pacman -S --needed dnsmasq hostapd iptables
cat <<EOF | sudo tee /etc/hostapd/hostapd.conf >/dev/null
interface=wlan0
ssid=BlitzLoop
hw_mode=g
channel=6
wmm_enabled=1
EOF
sudo systemctl enable hostapd
sudo systemctl start hostapd
cat <<EOF | sudo tee /etc/dnsmasq.conf >/dev/null
no-resolv
server=8.8.8.8
address=/blitz/192.168.42.1
address=/bl/192.168.42.1
address=/b/192.168.42.1
interface=wlan0
dhcp-range=192.168.42.100,192.168.42.200,12h
EOF
sudo systemctl enable dnsmasq
sudo systemctl start dnsmasq
cat <<EOF | sudo tee /etc/systemd/network/hostap.network >/dev/null
[Match]
Name=wlan0
[Network]
Address=192.168.42.1/24
IPMasquerade=yes
EOF
sudo systemctl restart systemd-networkd.serviceNow you can connect to the BlitzLoop SSID and browse to http://b/.
Audio processing already uses most of one core by default. Changing the speed or tempo in certain ways causes increased CPU usage and drop-outs.