Arduino Phased Step Sequencer

After using my slide potentiomers to control the timing and phase of rhythm, I wanted to turn my hand to pitch.  This is my first experiment.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key Arduino tutorials for the main concepts used in this project:

If you are new to Arduino, see the Getting Started pages.

Parts list

The Circuit

This is using the same circuit as for Arduino Multi-Slider MIDI Controller – Part 3.  In this example I’m using one of my Ready-Made MIDI Modules to talk to my MT-32 synth module.

IMG_5320

The Code

The general idea is to use eight of the slider pots to set the notes for an 8-step sequence and then use the other eight slider pots to change the relative tempo of 8 tracks playing the same 8-step sequence.  This way I can mess about with the phasing of the tracks with respect to each other.

To enhance the effects, each track can play the sequence slightly modified – i.e. shifted up or down by a fixed interval.

The notes for each step can be selected from the following set:

#define NUMNOTES 11
byte notes[NUMNOTES] = {
  60, // C4
  62, // D4
  64, // E4
  67, // G4
  69, // A4
  72, // C5
  74, // D5
  76, // E5
  79, // G5
  81, // A5
  84, // C6
};

This is two octaves of a pentatonic scale starting on C4. The analog range of 0 to 1023 for the note selection for each step is thus scaled to select one of these 11 notes.  The only quirk, is that I think the pots I have are probably logarithmic pots (which makes sense – I think they are “stereo audio faders”) which means that there is quite a large set of the physical sliding range associated with the lowest note!

The “modifiers” for each track were chosen as follows:

int modifier[NUMTRACKS] = {
  -24, -12, -5, 0, 0, +7, +12, +24,
};

This gives me two tracks in the middle “at pitch”, two tracks one (-12) and two (-24) octaves below, two tracks one (+12) and two (+24) octaves above, and one track a 4th below (-5), and one track a 5th above (+7).

I’ve kept the idea of using TimerOne to provide the “tick” for playing the steps and handling the reading of the pots in the main loop() from the Arduino Mux Slider Phased Relays project.

The only slight complication is that every time the “clock tick” for a specific track, instead of toggling a relay I now increment the step counter for that track, turn off the note from the last step, and play the new note for the next step.  Otherwise the basic idea is the same.

I’ve added the option to “mute” a track too. If the timing slider for the track as set to “maximum” then I set a flag that is checked in the playing routine and used to skip playing that track.

The code isn’t brilliantly robust – there is the distinct possibility that if you change the notes for a step then you might end up note sending the right “note off” MIDI message if that note was actually sounding at the time and there seems to be the odd extra message appearing every now and again that I’ve haven’t tracked down yet.

In theory it should work with a different number of steps vs tracks – they don’t have to be split 8 and 8, but that part of the code isn’t tested either and it is highly likely that I might have mixed up a NUMTRACKS with a NUMSTEPS or a NUMPOTS or a NUMNOTES… but while NUMTRACKS = NUMSTEPS = 8 and NUMPOTS = NUMTRACKS + NUMSTEPS it all seems to work fine.

The last thing I’ve done is slowed down the TICK.  I was particularly after a slower changing, more “ambient” type system so the basic TICK is now 5mS with the slowest time between notes now half a second (100 x 5mS).

Find it on GitHub here.

Closing Thoughts

I’ve already sat and played with this for quite some time.  You can hear it playing the “Harmo Pan” voice on my MT-32 which really rings on nicely as the notes change slowly. I left two tracks “at pitch” to explicitly allow me to try some phasing between the basic set of notes, but actually I really like have that accompanied by a slow-moving 2-octave below and the high 2-octave above. I am really pleased with these results.

I’ve not tried different step sequences yet – I really like the shape of the one in the video.  But there are so many ways in which to experiment with this now:

  • Use different scales – pentatonic is a relatively easy one to get nice “ambient” sounds with, but what about different modes or some jazz scales?
  • Use different modifiers – I went with tonic and dominant and when applied to the pentatonic scale seem to combine really well, but what about some dissonant modifiers?  I’ve also just added, but what if you multiplied?
  • Change the TICK.  I don’t know how much faster it could go, as the MIDI sending is within the “TICK” but it could wind up a little.
  • Change the range of the tempo. I’ve kept a linear link between number of ticks and the pot reading, but it could scale more to allow for some really long time intervals between notes.
  • Everything is sent on MIDI channel 1 at the moment, but each track could be sent on a different channel allowing different voices to move in and out of phase with each other.

Other enhancements could include using some of the Arduino’s IO in different ways – what could extra switches or pots allow?

Kevin

IMG_5319

Leave a comment