Source Code | Tickets | Trello | Twitter | Patreon | © Michael DeHaan, 2020



A slot is a step in a step sequencer that results in a note, chord, REST, or other events or actions.

Normally, when used in a Pattern, the values in a slot combine with the current Scale to decide what note (or notes) should play. When used with Transforms, these samelots help form the basic building blocks of powerful MIDI effects, including octave shifts, arpeggiators, and controls over pattern direction.

Values for slot parameters can be simple integers, strings, and booleans, but they can also be randomized and pulled from a variety of sources using Evaluators.

  The API Examples in the source checkout contain a wide variety of demos showing all of these patterns in context. Try following along with these examples in a new browser tab.

Creating A Slot 

We've already shown the basics of pattern construction in the Patterns chapter. The example included there played a 7-note scale:

api.patterns.add(name='basic', slots=[
  A slight fib: if a scale is not assigned, this will actually play the first seven notes of the 12-note Chromatic scale in C.
Here's another simple example involving chords:

api.patterns.add(name='chords', slots=[
    Slot(degree=1, chord_type='major'),
    Slot(degree=2, chord_type='major'),
    Slot(degree=3, chord_type='major'),
    Slot(degree=4, chord_type='major'),
], rate=0.25)
Rests are constructed as follows:

api.patterns.add(name='chords', slots=[
    Slot(degree=1, chord_type='major'),
    Slot(degree=3, chord_type='major'),
], rate=0.25)
Ties are also available:

api.patterns.add(name='chords', slots=[
    Slot(degree=1, chord_type='major'),
    Slot(degree=3, chord_type='major'),
], rate=0.25)

A Slot can have any of the following properties:

note string assigns an absolute note name like "C", "Bb", or "F#". Sharps and flats are interchangeable. Do not specify the octave here. Mutually exclusive with degree
degree int assigns a scale degree in the current scale. In C Major, "1" would be C, and "4" would be F. If the number is higher than the number of notes in the scale, it will access higher octaves. Negative indexes are not supported.
octave int assigns the octave to the note. If not assigned, the base octave 0 will be used, but this may be offset by the base_octave of the Instrument if the note was constructed by degree.
degree_shift int transposes the note up or down on the current scale by this many scale degrees
octave_shift int transposes the note up or down on the current scale by this many octaves
sharp bool if True, moves the selected note up a semitone. The result may be outside the current scale.
flat bool if True, moves the selected note down a semitone. The result may be outside the current scale.
chord_type string Turns the note into a chord, or changes the chord type if already a chord. Included chord types are listed below.
inversion int inverts a chord 0, 1, or 2 times. Has no effect on notes that are not already chorded.
track_grab string replaces the note that should have played at this step with the note that last played on the named track. Possibly restricted with track_copy above.
repeats int if set, the given note will be repeated an extra N times within the current slot length. For instance if the note was C4, and N was 4, a 1/16th note would turn into four back-to-back 1/64th notes.
length float multiplies the note length by this value. 0.5 gives notes half the usual length. If N is greater than 1, the notes may overlap if the following notes are not a rest, which may be desirable with monosynth portamento
delay float if positive, delays the note by this multiple of the note length. If the note was a 1/16th note, and the delay was 0.5, it would start an extra 1/32nd note beyond where it would have started. If negative, the timing is instead rushed by the same amount. The length of the note is unaffected. Used in this example to implement Swing
tie bool if True, the given note will not play, and the previous note or chord's length will be extended to fill this space
rest bool replaces this note with silence. This is best used with one of the random Evaluators.
velocity int sets the MIDI velocity value for this note. 0 to 127.
ccs dict assigns one or more MIDI continuous controller values for the current track
track_copy list of track names a bit complex - this restricts the usage of TrackGrab to only the specific named tracks, only for this particular step. This is best demonstrated in this note hocketing example. If track_copy is not set, any track is allowed to grab notes from this track.
variables dict assigns one or more variables as indicated by the dictionary. These are accessed with LoadVariable
Pattern Control
skip int if set, ignores this number of slots and grabs the note value from the next Nth note. This is best used with one of the random Evaluators.
shuffle bool if True, the pattern will be reshuffled when it gets to this step. This is best used with one of the random Evaluators
reverse bool if True, the pattern will be reversed when it gets to this this step. This is best used with one of the random Evaluators
reset bool if True, the pattern playhead will restart at the beginning when it gets to this step. This is best used with one of the random Evaluators
  Using note instead of degree will make any notes and chords produced immune to scale transpositions or octave shifts. This allows them to be used to sequence percussion tracks where, for example, C3 might trigger a kick drum, without risking a scale assignment that would select different MIDI drums. Always use note and octave and not degree for percussion tracks.

Chord Types 

Valid values for chord_types are:

This list can be expanded grow over time. Contributions and ideas for new directions or random distribution options would be welcome.

  An advanced tip: a slot cannot yet represent combinations of notes like C3 + C4 + C5. To achieve this however, it is perfectly fine to send notes at the same instrument from multiple Tracks, and Transforms could be used with Track Grabs and octave_shift to achieve this purpose.

Suggestions & Tips 

Next Up 

Now it is time for Scenes. We'll eventually re-use this Slot knowledge when we get to Transforms.

You may also wish to choose your own adventure and learn how to level-up Slots with Evaluators.