PureData + Raspberry Pi + Arduino
PureData?
PureData is a visual programming language for audio. With a little imagination, it can be used for many, many things. As a school project, I used PureData as a speech concatenation engine for generating Shakespearean Insults.
The PureData language is based around Data and Signal flow, so naturally the idea of building a guitar effects chain was a simple one to come up with.
The solidifying of a concept happened when I learned PureData could run on Raspbian OS.
The PureData language is based around Data and Signal flow, so naturally the idea of building a guitar effects chain was a simple one to come up with.
The solidifying of a concept happened when I learned PureData could run on Raspbian OS.
Project Overview
Conceptually, this project is a simple one, but it took me a lot of time to create and to work out the details.
Before I started this project, I had no idea how to use a Raspberry Pi, write arduino code, design electronics, or create guitar effects. Most of my time was spent researching, learning, and applying concepts to create a worthwhile product.
The main PureData program runs on a Raspberry Pi 3B with an Audio Injector Sound Card handling the audio input and output from the guitar.
I wrote some scripts in Raspbian OS to load up PureData on startup, so no user input is needed after plugging in the pedal.
For the knobs and Switches, I used a Teensy board running arduino software, which takes in input from the potentiometers and switches and converts that into midi data, which it sends into PureData.
All the code is available on GitHub here: https://github.com/NLavender/PureData-DSP-GuitarPedal
Before I started this project, I had no idea how to use a Raspberry Pi, write arduino code, design electronics, or create guitar effects. Most of my time was spent researching, learning, and applying concepts to create a worthwhile product.
The main PureData program runs on a Raspberry Pi 3B with an Audio Injector Sound Card handling the audio input and output from the guitar.
I wrote some scripts in Raspbian OS to load up PureData on startup, so no user input is needed after plugging in the pedal.
For the knobs and Switches, I used a Teensy board running arduino software, which takes in input from the potentiometers and switches and converts that into midi data, which it sends into PureData.
All the code is available on GitHub here: https://github.com/NLavender/PureData-DSP-GuitarPedal
How it Came Together
The program in PureData is pretty simple to look at and understand. The signal flows into the patch and can be routed through a number of effects that can toggle on and off.
EQ
The EQ is the only effect that can not be turned off.
I've created a very simple baxandall EQ by using PureData's built in high and low pass filters to separate out the signal into 3 bands. The signal from those 3 bands can then be multiplied by the input from the arduino and summed back up for a nicely EQd signal.
I've created a very simple baxandall EQ by using PureData's built in high and low pass filters to separate out the signal into 3 bands. The signal from those 3 bands can then be multiplied by the input from the arduino and summed back up for a nicely EQd signal.
Compressor
The compressor was the hardest to get sounding like a real compressor, and I definitely didn't spend enough time with it to get the sound right.
For this one, I ended up borrowing heavily from one I found online, and teaching myself how it worked by building it myself.
I had all of the parts correct on my own design, but I had issues getting a look ahead circuit to analyse the signal properly.
In a future version of the project, I will spend much more time tuning this compressor to make it sound good with a guitar.
The version I borrowed from is here: http://www.pd-tutorial.com/english/ch03s09.html
And additional resource I used for concepts is here: https://designingsound.org/2013/06/28/tutorial-a-compressor-in-pure-data/
For this one, I ended up borrowing heavily from one I found online, and teaching myself how it worked by building it myself.
I had all of the parts correct on my own design, but I had issues getting a look ahead circuit to analyse the signal properly.
In a future version of the project, I will spend much more time tuning this compressor to make it sound good with a guitar.
The version I borrowed from is here: http://www.pd-tutorial.com/english/ch03s09.html
And additional resource I used for concepts is here: https://designingsound.org/2013/06/28/tutorial-a-compressor-in-pure-data/
Distortion
Distortion was the other effect that took me a while to get sounding right.
My design utilizes the multi-band method from my EQ, which allowed me to distort different parts of the signal differently, giving me much more control over tone. For the actual distortion, I used PureData's built in clip~ function, which simply clips off the waveform when it exceeds the limit, along with a multiplier for signal gain on each band.
My design utilizes the multi-band method from my EQ, which allowed me to distort different parts of the signal differently, giving me much more control over tone. For the actual distortion, I used PureData's built in clip~ function, which simply clips off the waveform when it exceeds the limit, along with a multiplier for signal gain on each band.
Tremolo
Tremolo was definitely the most fun effect to create.
All I'm doing is using PureData's osc~ function to create a sine wave of a frequency and amplitude set by the input data from the arduino, and multiply the incoming signal by that sine wave.
I also multiply the amplitude of the original signal by .5 and add it back into the tremolo affected signal for a more guitar-like tone.
All I'm doing is using PureData's osc~ function to create a sine wave of a frequency and amplitude set by the input data from the arduino, and multiply the incoming signal by that sine wave.
I also multiply the amplitude of the original signal by .5 and add it back into the tremolo affected signal for a more guitar-like tone.
Reverb
Reverb was a strange effect to create, as I wasn't really sure what I wanted out of it, but the end result is pretty decent.
I used PureData's rev3~ function to create the reverb, which takes in some parameters, such as decay time, and affects the signal put in.
On the user end, I put knobs for wet and dry for control over the sound.
Reverb is definitely something I will revisit on the next iteration of this project.
I used PureData's rev3~ function to create the reverb, which takes in some parameters, such as decay time, and affects the signal put in.
On the user end, I put knobs for wet and dry for control over the sound.
Reverb is definitely something I will revisit on the next iteration of this project.
Delay
Delay was the most satisfying effect to create.
The way it works is I use PureData's delwrite~ function to preserve a signal and play it back at the integer multiple of a specified time, at a decaying volume.
Both the time and the decay are set by the user.
The way it works is I use PureData's delwrite~ function to preserve a signal and play it back at the integer multiple of a specified time, at a decaying volume.
Both the time and the decay are set by the user.