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.
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=[ Slot(degree=1), Slot(degree=2), Slot(degree=3), Slot(degree=4), Slot(degree=5), Slot(degree=6), Slot(degree=7), ])
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)
api.patterns.add(name='chords', slots=[ Slot(degree=1, chord_type='major'), Slot(rest=True), Slot(degree=3, chord_type='major'), Slot(rest=True), ], rate=0.25)
api.patterns.add(name='chords', slots=[ Slot(degree=1, chord_type='major'), Slot(tie=True), Slot(degree=3, chord_type='major'), Slot(tie=True), ], 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|
|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|
This list can be expanded grow over time. Contributions and ideas for new directions or random distribution options would be welcome.
- don't get overwhelmed by all of the options - start small and look at the first API examples to see basic Slot usage before learning more about what you can do - every single slot option is explained in the API examples
- Some Slot options are more interesting and applicable when used in Transforms than when used in Patterns
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.