I wanted to research a Raspberry Pi powered effects system for a guitar or synthesizer. I wanted to create cheap guitar effects pedals, or an entire amp simulator. I originally built the system using regular Pure Data on my Raspberry Pi 3, and I thought it would be AC-powered. Once I got thinking about it, I thought the guitar DSP I built may be able to run on a Raspberry Pi Zero and be battery powered. The main differences between the Pi 3 and the Pi Zero is the price and processing power. The Pi 3 is a Quad core processor and costs $40, while the Pi Zero is a Single core processor and costs $5. Once I brought the Pure Data code over to the Pi Zero, I had some initial issues. The first issue was with latency, so I learned about running pure data on a headless system. Inside of raspi-config, you can set a setting that does not load/use resources on the GUI and just runs a terminal. This saved a fair bit of cpu processing for the Pi Zero. Then I also ran Pure Data in something called headless mode with the -nogui flag. In order to get my external USB audio card to run, and Pure Data to launch on startup I wrote a bash script, and called it in /etc/profile. The script ran “pd -nogui /home/pi/Desktop/Guitar_Pi.pd &” which launches Pure Data in no GUI mode and loads the patch on the desktop, and the “&” flag lets the OS keep running Pure Data in the background. With this script/system in place you can plug in the Pi Zero to the USB battery, and it will just start processing low latency audio without any user interaction/ssh.
In musical terms, I built an initial gain system, a WhaWha effect, a Fuzz/Distortion effect, then Reverb from rev3~. Then there is a load bang that auto-starts the DSP in Pure Data. I used mostly FLOSS manuals and the internet to help me build the effects. ( https://booki.flossmanuals.net/_booki/pure-data/pure-data.pdf ) In the future I would like to build a small MIDI controller from a Teensy that would give small knobs and buttons to change parameters of the effects. The effects used were time domain signal processing effects. I would be interested in doing some FFT processing on audio and seeing if I can keep the audio latency still relatively low. I think it would be really interesting to build a master effects “backpack” for small battery powered synthesizers like the Pocket Operator. Or possibly an open source cheap synthesizer using only the Pi zero, and a custom MIDI controller.
Here is a picture of the system while being hooked up to a Pocket Operator synthesizer:
Here is the Pure Data text code:
#N canvas 573 76 890 733 10; | |
#X obj 178 132 adc~; | |
#X obj 201 680 dac~; | |
#X obj 296 106 vsl 15 128 0 127 0 0 empty empty empty 0 -9 0 10 -262144 | |
-1 -1 10000 1; | |
#X obj 250 344 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 | |
1; | |
#N canvas 174 207 450 300 Whawha 0; | |
#X obj 82 0 inlet~; | |
#X obj 90 263 outlet~; | |
#X obj 298 20 inlet; | |
#X obj 63 120 *~; | |
#X obj 132 125 *~; | |
#X obj 188 67 pack 0 10; | |
#X obj 188 87 line~; | |
#X obj 103 61 pack 0 10; | |
#X obj 103 81 line~; | |
#X obj 137 34 expr 1-$f1; | |
#N canvas 545 188 727 583 Whawha_Guts 0; | |
#X obj 110 13 inlet~; | |
#X obj 163 540 outlet~; | |
#X obj 372 34 switch~; | |
#X obj 372 7 inlet; | |
#X obj 203 469 vcf~; | |
#X floatatom 297 431 5 0 0 0 - - -, f 5; | |
#X obj 297 298 vsl 15 128 0 20 0 0 empty empty empty 0 -9 0 10 -262144 | |
-1 -1 3366 1; | |
#X obj 272 109 +~ 1; | |
#X obj 273 130 *~ 0.5; | |
#X obj 272 88 osc~ 2; | |
#X obj 374 165 hsl 128 15 700 6000 0 0 empty empty empty -2 -8 0 10 | |
-262144 -1 -1 0 1; | |
#X obj 328 238 hsl 128 15 0 700 0 0 empty empty empty -2 -8 0 10 -262144 | |
-1 -1 0 1; | |
#X floatatom 325 257 6 0 0 0 - - -, f 6; | |
#X floatatom 326 199 6 0 0 0 - - -, f 6; | |
#X obj 326 180 -; | |
#X obj 326 158 bang; | |
#X obj 226 264 +~ 200; | |
#X obj 225 182 *~ 1500; | |
#X text 323 105 <-- LFO (Low-Frequency Oscillator; | |
#X text 507 163 <-- Maximum of the freq. range; | |
#X text 461 235 <-- Minimum of the freq. range; | |
#X text 334 388 <-- "Q"; | |
#X text 245 468 <-- Voltage-Controlled band-pass filter; | |
#X obj 369 289 loadbang; | |
#X msg 367 314 5.3; | |
#X obj 217 503 *~ 3; | |
#X connect 0 0 4 0; | |
#X connect 3 0 2 0; | |
#X connect 4 0 25 0; | |
#X connect 6 0 5 0; | |
#X connect 6 0 4 2; | |
#X connect 7 0 8 0; | |
#X connect 8 0 17 0; | |
#X connect 9 0 7 0; | |
#X connect 10 0 14 0; | |
#X connect 11 0 12 0; | |
#X connect 11 0 14 1; | |
#X connect 11 0 15 0; | |
#X connect 11 0 16 1; | |
#X connect 14 0 13 0; | |
#X connect 14 0 17 1; | |
#X connect 15 0 14 0; | |
#X connect 16 0 4 1; | |
#X connect 17 0 16 0; | |
#X connect 23 0 24 0; | |
#X connect 24 0 6 0; | |
#X connect 25 0 1 0; | |
#X restore 122 181 pd Whawha_Guts; | |
#X connect 0 0 3 0; | |
#X connect 0 0 4 0; | |
#X connect 2 0 10 1; | |
#X connect 2 0 9 0; | |
#X connect 2 0 5 0; | |
#X connect 3 0 1 0; | |
#X connect 4 0 10 0; | |
#X connect 5 0 6 0; | |
#X connect 6 0 4 1; | |
#X connect 7 0 8 0; | |
#X connect 8 0 3 1; | |
#X connect 9 0 7 0; | |
#X connect 10 0 1 0; | |
#X restore 179 359 pd Whawha; | |
#N canvas 265 192 522 373 Fuzz 0; | |
#X obj 82 0 inlet~; | |
#X obj 90 263 outlet~; | |
#N canvas 529 379 450 300 Fuzz_Guts 0; | |
#X obj 110 13 inlet~; | |
#X obj 121 236 outlet~; | |
#X obj 372 34 switch~; | |
#X obj 372 7 inlet; | |
#X obj 109 71 *~ 10; | |
#X obj 110 113 clip~ -0.2 0.2; | |
#X connect 0 0 4 0; | |
#X connect 3 0 2 0; | |
#X connect 4 0 5 0; | |
#X connect 5 0 1 0; | |
#X restore 122 181 pd Fuzz_Guts; | |
#X obj 298 20 inlet; | |
#X obj 63 120 *~; | |
#X obj 132 125 *~; | |
#X obj 188 67 pack 0 10; | |
#X obj 188 87 line~; | |
#X obj 103 61 pack 0 10; | |
#X obj 103 81 line~; | |
#X obj 137 34 expr 1-$f1; | |
#X connect 0 0 4 0; | |
#X connect 0 0 5 0; | |
#X connect 2 0 1 0; | |
#X connect 3 0 2 1; | |
#X connect 3 0 10 0; | |
#X connect 3 0 6 0; | |
#X connect 4 0 1 0; | |
#X connect 5 0 2 0; | |
#X connect 6 0 7 0; | |
#X connect 7 0 5 1; | |
#X connect 8 0 9 0; | |
#X connect 9 0 4 1; | |
#X connect 10 0 8 0; | |
#X restore 180 400 pd Fuzz; | |
#X obj 238 385 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 | |
1; | |
#X obj 195 231 / 127; | |
#X msg 195 259 \$1 10; | |
#X obj 194 292 line~; | |
#X obj 178 320 *~; | |
#X obj 195 524 rev3~ 100 90 500 30; | |
#X msg 294 78 100; | |
#X obj 295 49 loadbang; | |
#X obj 281 318 loadbang; | |
#X msg 331 77 \; pd dsp 1; | |
#X connect 0 0 10 0; | |
#X connect 2 0 7 0; | |
#X connect 3 0 4 1; | |
#X connect 4 0 5 0; | |
#X connect 5 0 11 0; | |
#X connect 5 0 11 1; | |
#X connect 6 0 5 1; | |
#X connect 7 0 8 0; | |
#X connect 8 0 9 0; | |
#X connect 9 0 10 1; | |
#X connect 10 0 4 0; | |
#X connect 11 0 1 0; | |
#X connect 11 1 1 1; | |
#X connect 12 0 2 0; | |
#X connect 13 0 12 0; | |
#X connect 13 0 15 0; | |
#X connect 14 0 3 0; | |
#X connect 14 0 6 0; |