Adafruit fifteenstep sequencer

Hey! I just found this cool arduino sequencer library:

And I think I might be able to steal some parts and add them to the awesome Arduino MIDI Looper by @YMNK so I can make that one polyphonic!

I think the code of the fifteenStep library is very elegant. It has a single sequence variable which stores all notes for all channels. That way the total number of notes is limited, so if you allocate 1kB from the SRAM and every MIDI notes has 4 bytes (channel, pitch, velocity, step-on-which-to-turn-on-or-off), you get 250 notes. You could use all of them on a single chord in a one step sequence :wink: , or you can have almost 4 monophonic channels of 64 steps (256 notes). You could even use and external SRAM chip and get very long sequences!
It might be possible to make a very cheap, but quite capable little sequencer from this!

So, here comes my question for all of the programmers here :wink: :
Why is the sequence variable a heap? Why does it need to be sorted? Okay, it has to be sorted to fulfill the heap property, I understand that part, but why do we need this for the sequence?


I just looked at the code briefly. Seems like the sequence store the position of the note and then when the timer reach that position, it will look at all the position of the each note to find the note to play.
That’s indeed different than my implementation (where the index in the array IS the position of the note in the sequence).
This way, yes you can make a very powerful sequencer with polyphony and stuff but you’ll still have a note limit (which could be difficult to reach btw, so this is not a bad idea at all)

Next year I will work on a new version of my Looper, with polyphony, length, poly-rythms, randomization, arpeggiators, autochords, scales correction and transposition and such … I don’t know if I’m gonna use this code but I started to think about a way to save some space in the RAM by splitting variables in 2 ( for instance using the 7 first bits of a byte for the MIDI value and the last bit for a boolean, things like this …)


Yeah, that implementation is cool, but why the sorting (’_heapsort‘)?

That sounds like a great project! So maybe I should just wait till you have done it before I start yet another project :wink: will you stick to Arduino or do you think it needs something more powerful?

I guess that when the array is logically sorted, finding the the next note would take less time for the CPU?

Yes, I will stick on Arduino Nano, I will try to make everything fit in a tiny RAM. If it is not possible, will move to Mega.

1 Like

thanks for the awesome information.

1 Like