Sunday, October 4, 2009

Homemade guitar looper with Arduino


Here is how to produce pedalboard for electric guitar. The idea is to connect pedals to the Arduino, and to use them to control a software of sound processing in Pure Data. Here I show you the example of a looper, but one can be also made a rack of effects without problem.

A video of the looper in action is available here :


First of all, something you must understand: our pedals break up into two parts: the controls part and the sound part. The control part is composed of:
  • several pedals (footswitch, pedals of expression).
  • Arduino to connect them to the PC.
  • a driver: here it is about a Pure Data patch, which allows to use easily what Arduino sends to us.
The sound part:
  • an electric guitar.
  • a sound card which one connects it.
  • the software which treats the sound: here, it is thus about a Pure Data patch.
The pedalboard are thus used only to control a software of sound treatment.

Electronic part

Overall picture

As it there is seen, my pedalboard is composed of (from left to right):
  • an expression pedal: it is connected on a catch RCA.
  • a footswitch with 2 switches: it is connected on a catch stereo jack
  • finally, 2 switches which leaves in mono jack.
The assembly is simple: first, get the jacks catch which correspond to the pedals. Then, connect them on a small circuit which one even manufactures oneself. The idea, it is that each switch will be crossed by a 5 volts supply, provided by Arduino. Then, depending on the pedal state, the power is on (or off). With the pedal of expression, it is only a potard, which will modulate the power supply sent by Arduino.

Each pedal must thus be connected to the alim 5V provided by Arduino on the one hand, and to the mass of the other. Just put a resistance between the pedal and the mass: it is about a resistance of pulling. And here, connect the pines digital (or analogical for the pedal of expression) of Arduino, knowing the tensoin there and thus knowing if the pedal were actuated.

Close-up on the circuit

A close-up to see the circuit, but which does not show large thing.


 Electric diagram

Small diagram which shows that it is very simple.

Data-processing part

Code embedded on Arduino

Now that the assembly is made, we must write the short piece of code which one will embark on Arduino to manage all that.

Here also it is very simple: only the role of Arduino is to know the values of each switch (open/closed, 0/1) and of the potar (value between 0 and 1), and to send these data to the computer .

This code, one writes it with the kit of development provided with Arduino. For the communication between the chart and the ordi, one uses the lib Firmata, provided with the SDK.

See link below for the source code.

Comments on this code

Thus of course, this code corresponds precisely to the assembly which I carried out. But it is very easy to adapt to any assembly of the same style.

The use of the variables '' prev_… '' makes it possible to send data only when one of the values changes. As long as one does not touch with any pedal, the chart doesn't send anything. That avoids flood on USB port, and to tire the chart unnecessarily.

Pure Data Part

Driver Pure Data

Well. All the part with Arduino is made. It is now necessary to make communicate our chart with Pure Data. For that, I used Pduino. It is a Pure Data object which is interfaced with Arduino. It requires to have used the lib Firmata on the embedded code.

Available at this address:
Once one manages to make communicate our Arduino with Pure Dated, one can start to program a small driver. It only handle simple tasks:
  • to establish the communication with Arduino.
  • to recalibrate what the expression pedal gives us to obtain a value between 0 and 1.
  • to make sure that the switches give well until one waits.
  • to send the values wanted thanks to send objects, so we can use them in others patches.
The Pure Data driver for the pedals is in the zip file (see following section), under the name arduino-driver-0-0-5.pd.

The looper

From there, one made all the part controls pedals. Remain the sound part. I will not extend too much on this part, which does not relate to really any more Arduino.

I only give the 2 Pure Data patches I made and use in the youtube movie :
  • looper-0-0-3.pd It acts of an object which carries out a loop of the input signal. One controls it by messages:
    • start: start the recording of the loop.
    • stop: stop the recording of the loop.
    • toggle: start to play the loop, or asks him to stop as soon as it arrives at the end.
    • kill: immediately stop the loop, and reset the looper. I.e. one can't call back the loop with toggle anymore.
    • float: one can also send a float. That is used to force the size of the loop to a multiple of this value. If X is sent, the loop will be forced with the one of the following sizes: X/4, X/2, X, 2X, 4X. But what for?? That is used when one has several loopers in parallels, so that the loops remain synchronized.
  • looper-test-3.pd This patch uses the precedent. It makes it possible to use 4 loops in parallels. The expression pedals makes it possible to control the volume of the loops. One of the switches is dedicated to change loop. The 3 others are used to control the looper.
The 3 Pure Data patches are there:

Note: I am a very occasional user of Pure Data (the last time that I served myself it of it was y' is 2 years old well), then if y' has people who know well and throw an eye with my patches, it can make them odd. I just made a point of preventing. I used quite ugly tricks, but I did not know how to do them differently.


The interest of this is multiple:
  • the price: my pedals cost me about 100 euros by counting the carriage costs.
  • flexibility: so tomorrow I need to add an unspecified pedal, I just add it on my assembly and they is good. No need to buy a new whole pedalboard.
  • an infinity of applications: from the moment you're used to Pure Data, you can work your sound of guitar as you wants, and can control it as you want, since you choose what the pedals do. Thus the possibilities are enormous for people impassioned, and who have free time. 

Edit 2014

A new version of the source code is available on Gitlab for those interested:

About Me

french version here :