Raspberry Pi
Pure Data [ Autorun ] / Audio Injector
1. Flash Raspberry Pi OS
Download Raspberry Pi Imager and flash Raspberry Pi OS Lite (32-bit) to a microSD card. Enable SSH and set hostname, user, and Wi-Fi credentials in the imager settings before writing.
In the imager, click the settings gear icon (or press Ctrl+Shift+X) before writing.
General Set hostname (e.g.) raspberrypi Username and Password.
Services Enable SSH and select "Use password authentication".
General Enter your Wi-Fi SSID and password, and set the locale and timezone. Click Save, then Write.
Boot the Pi, then connect via SSH:
ssh pi@raspberrypi.local
Update the system:
sudo apt update && sudo apt full-upgrade -y
sudo reboot
2. Install Pure Data
sudo apt install puredata -y
Verify the installation:
pd --version
3. Install Audio Injector drivers
The Audio Injector Zero / Stereo uses a custom ALSA driver. Add the overlay to the boot config:
sudo nano /boot/config.txt
Add at the bottom:
dtoverlay=audioinjector-wm8731-audio
Disable the onboard audio to avoid conflicts:
# Find and comment out or remove:
dtparam=audio=on
Save and reboot:
sudo reboot
Confirm the card is detected:
aplay -l
You should see audioinjector-pi-soundcard listed. Set it as the default ALSA device:
sudo nano /etc/asound.conf
Add:
pcm.!default {
type hw
card 0
}
ctl.!default {
type hw
card 0
}
Test playback:
speaker-test -t sine -f 440 -c 2
4. Configure Pure Data for headless audio
Test that Pure Data opens with the Audio Injector:
pd -nogui -alsa -audiodev 0 -r 44100 -audiobuf 50 your-patch.pd
Adjust -audiodev index to match the card number from aplay -l if needed.
5. Autorun a PD patch on boot
Place your patch in a fixed location:
mkdir -p /home/pi/pd-patches
cp your-patch.pd /home/pi/pd-patches/main.pd
Create a systemd service:
sudo nano /etc/systemd/system/pd-autorun.service
Paste:
[Unit]
Description=Pure Data autorun
After=sound.target
[Service]
User=pi
ExecStart=/usr/bin/pd -nogui -alsa -audiodev 0 -r 44100 -audiobuf 50 /home/pi/pd-patches/main.pd
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable pd-autorun.service
sudo systemctl start pd-autorun.service
Check the status:
sudo systemctl status pd-autorun.service
View live logs:
journalctl -u pd-autorun.service -f
The patch will now launch automatically on every boot. To stop it temporarily:
sudo systemctl stop pd-autorun.service
To disable autorun:
sudo systemctl disable pd-autorun.service