Sunday, August 25, 2013

The Raspberry Pi Guitar Effect Box

Today I wanted to post an article about my Raspberry Pi based guitar effect box. Here we go:

 This project, as mentioned previous, is a guitar effect unit based on and powered by a Raspberry Pi "micro-computer" and the free DSP software "Pure Data". All of the effects are written in the Pure Data (Or "PD") language. The effect box currently contains 15 effects in all, but the entire system was built around the concept that the user should be able to switch out effects for new ones very easily. Continuing on, the effect unit (Or "pedal" as I'll refer to it from now on) consists of six main components: The buttons, the potentiometers, the VFD display, the ADC (Reads pots), the USB sound card, and the Raspberry Pi itself. I'll now go over what each component does. First, the buttons. There are three momentary push buttons on the front panel of the pedal. They enable you to cycle through effects and enter menu screens. The top most button acts as a "next" button, cycling through to the next effect, and the bottom most buttons acts as a "previous" button, cycling through to the previous effect. When the middle button is pressed, the pedal enters "edit mode", in which the user can edit the parameters of an effect, such as a chorus's speed or depth, by using the four potentiometers on the front of the pedal. This brings us into a description of how the potentiometers function. Each potentiometer is wired as a voltage divider into a channel of the ADC chip, which converts the voltage off the pot to a digital value, and that digital value takes the place of a hard coded value in a PD effect file, thus changing a certain parameter of an effect.  Moving on, when the pedal is in "normal" (non-edit-mode) the VFD display shows the name of the currently selected effect, and what it's editable parameters are. The parameters are listed from right to left, corresponding to their own potentiometer. Using the image below as an example, the user has selected the effect called "Chorus" using the next/previous buttons. You can see that the editable parameters for this effect are (from right to left): Speed, Depth, and Fdbk (Feedback). If the pedal were in edit mode, the parameter "Speed" would be controlled by potentiometer #1, the one closest to the orange cable; the other parameters following suit with potentiometers #2, and #3.
The front panel, showing the buttons, pots, and VFD

Now we have covered 4 of the six components. Next is the USB sound card.

Inside the pedal

The photo above shows the internals of the pedal. In the top center you can see the Raspberry Pi model B, the heart of the device. Connected to it via the GPIO pins is the main circuit board, which holds the ADC chip and various resistors. I'll provide a link to the schematic at the end of this post. Also connected to the Raspberry Pi is a small black rectangle with both a yellow and a black cable connected to it. This is the USB sound card. The yellow cable is the audio input from your guitar, and the black is processed audio out from Pure Data. The reason a USB sound card was necessary was because the Pi doesn't have a built in audio-in port. Having covered 5 of the 6 main components, all that remains is the Raspberry Pi. I'm not the person to explain the Pi, so I'll redirect you here to learn more about it.
Finally, to end this post, here are some more pictures:
The VFD display and four pots
A shot of the pedal with my amp and strat


  1. Very nice,
    Can you expand more on your ADC set-up? Are you using an I2C interface? Or is it more basic?

    With regards to the usb soundcard: what is the model of your card? Are you noticing latency issues?
    If so: would you consider a Real Time Operating System and input through some kind of IC2 module as an alternative?

    1. Thanks! I'm using I2C to communicate with the ADC. I couldn't tell you much more than that though, because the code I used was actually a sample code snippet. Haha, I'm still learning. I could talk all day about TTL serial, but I have to read more into I2C. To answer your question about latency: I've noticed none at all, but a combination of I2C and a real time OS would be cool. I just know Linux best of all the other OSes out there. By the way, my soundcard has this model number on the back of it: FG-UAUDV1-C119
      Thanks for your comment! -Ben
      Ps, I'm not sure if you've been there yet, but I have a git hub page for this project that contains the file "instructions.txt" that goes into more depth on things than I can in this comment. Also, if you haven't seen my video demo for the effect box, you can go to my youtube channel and watch it:

  2. Dear Ben
    Great job congrulation.I want learn How can load Pure Data software to ATMEL or Microchip controller also could you show any one effect source code
    Great project and thanks for all details

  3. Hello Path Finder,
    I'm glad you enjoyed this article!
    Sadly, there is no way to run pure data code on an ATMEL chip, or any 8-bit microchip. Pure data is a programming language that was made to run on Linux, Windows or Apple computers, and not micro controllers like the ATMEL line of chips. I believe the smallest device that can run pure data code at the moment is the Raspberry Pi.

    Thanks for commenting,

  4. Hey Ben,

    Awesome project. I am doing something similar now for school. I had a question when setting up the sound card. So, once we set up the sound card how difficult is it to access the data on the rPi? What if we didn't want to use Pure Data, would that make it substantially harder to access the raw guitar data and do some DSP? We have been using aplay for our current DAC but our ADC was causing issues so we were planning on switching to a sound card.

    Thanks in advance.

  5. Hi John,
    It's cool to hear that you're making a project similar to this for school!
    While I'm pretty sure you can access the raw data from the sound card in Linux, I'm not sure how you would do it. In my opinion this would be somewhat harder than using a sound card in PD, but on the other hand, pure data on the raspberry pi was VERY difficult to get working properly in some cases. I'm not sure what language you plan to program in, but here is a good page I found that might help you:
    It's for C and C++, but I'm sure the basic principles could be adapted to another language! Thanks for your comment,

    1. Thanks so much for the response. I got the sound card and the process is going a lot smoother. I had one more question. What was your wiring from the guitar input jack to the 3.5mm? I have one of the iRigs but I figured I could just solder it myself.

    2. Hi John,
      Good to hear it's working.
      To wire the input jack to the sound card, all you have to do is wire the signals (Tips) together and the grounds together. But if you do it this way (with nothing in between the sound card and the input jack), your guitar signal might sound distorted or "muddy". To fix that problem, just use a preamp circuit before the sound card input. This is something I didn't think of when I built the effect box. The iRig already has a preamp in it, but I don't know if it works with PC sound cards or only with iOS devices.

    3. Hey Ben,

      We are getting close to the end of our project. But, we are getting sound popping with our current configuration. We are not sure if it is the ALSA library that we are using or if it is the Sound Card. Did you ever have any popping issues with your Sound Card?


    4. Hi John,
      Good to hear you're almost finished!
      I did have a problem similar to what you're describing... For me it was caused be insufficient current getting to the sound card. If you have an original (Without mounting holes) model B raspberry pi, you have to short out one of the usb poly-fuses. This is because the pi cannot supply enough current to the sound card through the fuse, so the card makes weird popping noises. Just google "Short raspberry pi polyfuse". If that doesn't work, I've heard that some people have had to set the pi's USB ports to USB v1.1 to make some sound cards work properly. I don't know how you do that, and I think it disables keyboards/mice, but I think it would be easy to find a guide on google.

  6. Hi Ben,
    Very cool project - Wish I'd come across it a long time ago.
    I've been trying to implement a pitch shifter on the Raspberry Pi 3.
    The phase vocoder is the best effect in Pure Data.
    But I don't have a clue how to program it for live data (most implementations use
    a recorded sound file).

    Did you ever consider doing the pitch shift effect on your project?
    Thanks for getting me inspired again!

  7. Hi John,
    I'm a fan of pitch shift effects as well. I did want to include one in this project, but if I remember correctly I had a hard time understanding how to write them, so in that sense we're in the same boat, unfortunately. Have you seen this page? It talks about one of the built in pitch shift examples in PD (I think there are at least 2 or 3)

    Ps, I did write a ring modulator effect, which maybe isn't quite what you're looking for, but it could be a starting point. A ring mod is the same effect as used for the dalek voices on Dr. Who. It sounds a little like a pitch shift, but really it's just modulating the audio around a specific frequency, to my understanding.

    Sorry I couldn't help more!
    Thanks for the comment.

  8. Hi Ben,
    I'm a novice when it comes to programming things for the pi. I know I can put the circuit together without any issues, but I'm not sure how difficult it is to use an LCD display like this instead of the VFD you have.


  9. Hi Ben,
    thanks for sharing this awesome project. I´m planning to port your development to the 9$chip sbc.
    Just got one question regarding your schematics in github: You are powering the MCP3008 with 5V (also 5V on reference voltage). Why does this no damage to your RaspberryPI as this device is only tolerant for 3.3V for the GPIOs. Or is the SPI-Bus 5V-tolerant?

    Thanks for your answer in advance!


  10. Hi Ben. I am very keen to talk to you about this effects box you've created, as we want to do something similar with a guitar, but onboard the guitar itself. Is there any way of a more direct method of contact ?
    Alan Arnold Guitars.