I’ve programmed a sequencer for the Arduino microcontroller platform, designed to be used with the Sparkfun MIDI Shield. The sequencer combines an arpeggiating sequencer like that found on the Access Virus with a transposable recording sequencer, similar to the one on the Roland SH-101.
get it here.
I make fairly extensive use of MIDI in my own setup, so I’ve tried to keep the sequencer fully compatable with all MIDI data, SYSEX included. Any data not used by the sequencer channel should be passed to the output, and the sequencer has a ‘bypass’ function for which all MIDI data is passed directly to the output. The sequencer also stores and sequences velocity data along with the note data.
The mode is selected with the ‘A0‘ knob – if it’s all the way counter-clockwise, the sequencer works in recording mode. Other positions select pre-defined sequences to use in apeggiating sequence mode.
There are three selectable ‘trigger modes’ for the sequencer – inspired by the sequencer modes on the DSI Evolver. By default, the sequence runs normally, but can be set to run in ‘note gate’ or ‘note retrigger’ modes. In these modes, the sequencer only plays when notes are held. In ‘note gate’ the sequencer runs muted, and unmutes with notes held. In ‘note retrigger’ mode, the sequencer restarts when a new note is played (after all notes have been released).
The D4 and D3 buttons work as ‘shifts’ – holding these give the knobs and other buttons different functions. Here’s a summary of the controls:
A0: sequence select
A1: note length
D2: start/stop playing, or restart sequence if synchronised to external MIDI clock
D4: erase notes when recording
shift D4+A0: tempo, or step duration if clocked externally (from 32nd notes to dotted 8ths).
shift D4+A1: sequence loop length – fully clockwise, the entire sequence is played. turning counter-clockwise shortens the number of steps the pattern is looped by adjusting the end position.
shift D4+D2: temporarily mute sequencer (inverted for ‘note gate’ trigger modes).
shift D3+A1: trigger mode – counter-clockwise is normal, in the middle is ‘note gate’ and clockwise is ‘note retrigger’.
shift D3+D2: arm record when in transposable recorder mode (A0 fully counter-clockwise). The red LED will come on, and blink on the first step of the sequence.
shift D3+D4: bypass. The green LED will come on fully to show the sequencer is bypassed.
some more information on the modes:
Transposable Recording Sequencer
Turn A0 completely counter-clockwise, press play (D2) or start the master MIDI sequencer, then hold D3 and press D2 – the red LED should light. The sequence is now recording. any notes received on the sequencer channel will be recorded and looped continuously (overdubbed). To erase notes, press and hold D4 – only steps that would be played while D4 is held will be erased.
To exit recording mode, hold D3 and press D2 again – the red LED will go out. The sequencer is now in transpose mode, using the lowest note recorded as the transpose basis. Any note pressed above or below the basis note will transpose the entire sequence up or down. Transpose can also be used in combination with ‘note gate’ and ‘note retrigger’ modes.
There are currently seven stored patterns that this mode can use. Changing these patterns, or adding more, is pretty easy to do in the Arduino sketch. One of the patterns, for example, looks like:
Each number represents one of 16 steps. The zeros are rests – no note gets played on that step. The other numbers represent the order of the notes in the chord that was last played. If less than 8 notes were played, the numbers ‘wrap’. For example, say a C-Major chord is played, C-E-G, in that order. The sequence would then be:
Going back to C again on the first step of the sequence.
The Arduino sketch is included here.
I’ve also included the version of the FortySevenEffects MIDI library I used to compile. This is the current ‘dev’ branch of that library and includes some MIDI thru functions that might not be in the main library. It’s what I used for testing, so everything should work as expected if you include it in your /libraries/ folder ‘as is’ when compiling.
If you want to dive into the provided code, there are a few things that are simple to change. At the top, the CHANNEL define number can be easiliy changed to allow the sequencer to operate on a different MIDI channel, and this should cause the data on other MIDI channels to be passed to the output. Note that the MIDI channels are not zero indexed – channel 1 is 1 and channel 16 is 16.
The sequence length can be changed with ‘const int maxSeqLength=16;’ Note that the data in int ‘noteSeq[numberSequences][maxSeqLength]’ will have to be amended accordingly.
Finally, the maximum number of notes that can be held in a chord is currently 8. Holding more will push out the earlier notes (as will releasing only some notes and pressing new ones). If you’d like to increase or decrese this from 8, change ‘const int holdNotes=8;’ and update the ‘activeNotes’ and ‘activeVelo’ arrays accordingly. The ‘noteSeq’ data will also have to be changed to reflect the reduced or expanded number of notes available.
There is also a ‘hidden function’ I haven’t mentioned, but should be evident from the sketch
Big thanks to Francois Best for his excellent work on the Arduino MIDI library, and for the quick response in getting it up and running with this sketch!
Thanks also to William Bajzek for some initial inspiration from his Arduino arpeggiator project.