A loop station, or a looper, is essentially a tool to playback in real-time your instrumental riffs (loops). It's not intended as a recording media, but an instrument to shape the inspiration without distraction (and eventually perform live...).
There are plenty of audio recording loop stations out there, both in the form of dedicated hardware (almost every single guitar pedal manufacturer has its own product) or computer software (the excellent Linux Sooper Looper or windows Mobius, to cite the most known). I could only find few projects about DIY non-audio but MIDI loopers, meaning a tool to record MIDI events and play them immediately back in a loop; most of these projects (all of them, I should say) are abandoned or lost ... well, here we are with a complete project for everyone!
This Arduino MIDI loop station simply keeps track of incoming MIDI events and play them back. You only have to press the record pedal, create your best riff ever and stop recording by pressing the pedal again. Super easy :)
This project is based on easy to find open hardware (Arduino DUE), software (my own firmware and Arduino IDE) and can be customized to reflect you preferences.
Let's do it!
PS: yes, it's super cheap!
Step 1: Limits
Before you start to acquire hardware parts for the project, let me tell you which are its limits so that you can decide to go forward or stop here.
- due to hardware limits (Aduino DUE memory essentially), the default maximum lenght of the phrase you can record is limited to 46 seconds.
- loops cannot be stored and played back after shut down. You can send them to a PC and save them, though.
- there's no notes quantization.
- MIDI clock is supported, but on a preliminary stage at this time.
- MIDI messages recorded are note on, note off, control changes and pitch bend; other MIDI messages such as after touch, program change, SysEx, etc. are disregarded.
- max polyphony is set to 10 by default (again, Aduino DUE memory limits).
On the plus side, MIDI streams from multiple different instruments, each transmitting on it's own channel, are supported; this means that you can record multiple MIDI instruments at once, layered or with their own track (more pros on the next step ;) ).
If liveing with these limitations seems reasonable (and it is for me), you will have a very good time with this thing ;)
Step 2: How It Works
The MIDI loop station here is very simple to operate. It works in a way similar to those hardware audio loop stations every guitar pedal manufacturer has in its own catalog.
1) Select the track you want to record your MIDI sequence to. By default track "one" is chosen, but you can change it by pressing one if the tracks buttons (one for each track).
2) When you press the "REC" switch/foot pedal the first time, the looper is engaged. The green LED lights up. It will wait untill your first note is received before starting to record the actual sequence/riff.
3) When you have finished your sequence, press the "REC" switch/foot pedal again to define the actual lenght of the riff. The green LED lights down. The looper will start to reproduce your MIDI sequence immediately. If you reach the max time, recording will stop automatically and the sequence will start being reproduced in a loop.
4) Now, you can decide to overdub your sequence on the current track or select a new track and record on it, by depressing the "REC" switch/foot pedal. In both cases the yellow LED will light up, even if the new track is empty, because it is a "slave" track (slaved to the very first track recorded). Press again to stop overdubbing (LED down).
For those of you confortable with audio looping stations, this MIDI progression is called "REC/PLAY/OVERDUB" and is the only supported.
If at any time you feel that your latest overdub is not ok, you can delete it by pressing the "undo" switch/foot pedal. You can clear the whole current track by keeping the "REC" pedal pressed for more than 3 seconds; you can reset the looper (software reset) by pressing the first three track buttons at the same time or by clearing all the used tracks.
You can mute/unmute a track by pressing the track button of the current track.
You can send a PANIC! message by pressing the panic button. You can even send a PANIC! message by pressing the first two tracks buttons at the same time.
The looper has a built in simple metronome: a note on MIDI message for note number "64" is sent at a 100 BPM on channel 10 (the channel you presumably have your drum machine listening to). You can increase or decrease tempo by turing the optical encoder; by depressing the optical encoder switch you can enable/disable the metronome. Notice that your drum machine must be set to play a sound (snare, bass or whatever sound you prefer) when receiving MIDI note "64" or the metronome will be mute.
A barebone version of this MIDI loopstation could be made up with a single foot switch to start and stop recording and stop recording. Keeping the switch pressed for more than 3 seconds will re-initialize the loop station. Simple as that.
If you want to invest some additional time developing the hardware, adding switches and buttons will make the loop station more flexible. In the picture is how I have configured my four tracks (up to five are supported) full featured loop station.
IMPORTANT NOTE: the hardware in my pictures is a prototype. I used more jack sockets than needed but only four buttons for tracks. This is because when i started the project I was not completly sure what the final requirements would be.
Buttons and foot switches are electronically equivalents and you can use one instead of the other; for my needs, being that there is always too little floor space (damn lovely effect pedals ;)), I have constrained foot pedals to the single REC function.
Step 3: Hardware
Bill of materials:
Full featured 5-tracks MIDI loop station:
1x Arduino DUE (15-35 euro)
7x momentary push buttons (4 euro)
1x plastic case (I used a 150 x 110 x 70 mm case, 3 euro)
2x 5-pin DIN female panel mount MIDI socket connector (2 euro)
1x 6.3 mm panel mount jack socket (1 euro)
1x double sided 50x70 mm perf board (1 euro)
5x 3 mm LED (green) (1 euro for all required LEDs...)
1x 3 mm LED (yellow)
1x optical encoder (1 euro)
1x 6N138 optocoupler (1 euro)
1x 1N4148 diode (1 euro ... for 100 pcs)
3x 1000 ohm resistors (1 euro for all required resistors)
1x 10000 ohm resistor
3x 220 ohm resistors
7x 150 ohm resistors
1x 470 ohm resistor
Some solder wire, some cables, soldering station... and spare time :)
Time required to complete the project: 6-9 hours
Why not a UNO?
First tests (and a starting working code) was written on a "regular" arduino UNO board. This board has RAM limits that forced me to reduce the polyphony to "4", max lenght to less than 4 seconds and a resolution of 40 ms at max. This with no multichannel handling. By removing the velocity tracking too, I was able to rise the recording time up to 7 seconds.
With a UNO you can realize a "working" MIDI loop station then, but highly limited.
Step 4: Software
The software heavily rely on FortySevenEffects MIDI library. This library is great and makes this sort of projects doable even for non coders geeks like me.
Arduino IDE and it's community is another important part of this "success".
I will not go into details about how to upload the sketch to your arduino DUE. If this is your first experience with arduino IDE, please read this first.
The working principle is simple (and probably not the most efficient): during recording or overdubbing Arduino DUE checks and stores in it's (volatile) memory the supported MIDI events (note on, note off, control change and pitch bend); time axis is quantized in 20 ms steps and received messages are stored in those slots accordingly. While playing, stored MIDI messages are sent back to the synth respecting the time quantization.
There's a preliminar Clock handling too, but it will need some tweaks to work as it should. The working principle is the increase/decrease of the time quantum lenght as a function of the received BPM. Code assumes that you record a 4/4 - 4 bars loop (16 beats).
You can deactivate external clock by keeping pressed the "panic" button when turning on the looper.
The code is here attached. Comments are placed all over it, so that you can bend the firmware at your will ;)
Step 5: Wirings
MIDI IN and MIDI OUT circuits are reported in the attached pics. Notice that TX1 and RX1 are used, not TX0 and RX0.
Arduino DUE input pins cannot handle 5V at it's inputs; this is why a voltage divider is here used to reduce the signal going to TX1.
LEDs are connected to Arduino DUE output pins via a 150 Ohm resistor. You can use 220 ohm resistors too.
Buttons/switches/jacks are directly connected to Arduino input pins thanks to input pullup resistors, activated in the sketch. There's no need for external (pulldown) resistors.
The optical encoder is connected directly to Arduino input pins and there's no need for other resistors.
Arduino DUE is powered directly from Vin pin and ground via a +5V DC hub.
All grounds are tied toghether.
Attached is a table with connections from arduino pins to IN/OUT peripheral. Arduino pin numbers reflect those in my proptotype hardware and could look (they someway are...) random. You can easily modify the pin location in the sketch at your will ;)
Step 6: What If I Have More Than One MIDI Source?
After a brief search for a MIDI merger, I found that the most practical (and cheap) solution was a MIDI switcher.
A MIDI switcher is a passive device that enables a MIDI source and disables all the other sources. Simple as that.
The heart of a MIDI switcher is a multi positional (mine is 6 position), 2 poles switch. It is very important that the number of poles is "2" because every MIDI socket must be completely cut if unselected and not in comunication with the others. Attached is a pic of the one I realized for my own use.
At THIS LINK a scheme.