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

Patterns


About

Patterns hold series of notes (or expressions) in the form of Slots, which are played by Clips. Patterns can move in a forward redirection either infinitely or a set number of times, or also move in other directions.



Creating A Pattern 

To better explain Patterns, we'll briefly show some basic Slots, though they are explained further in the next chapter

A basic pattern


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),
])

The above pattern plays the current scale, assuming a seven-note scale. Once again, there is infinitely more involved with Slots and that's the next chapter.

A pattern has the following properties:

Property Type Description
name string A symbolic name for the pattern, as referenced from a Clip or Track Grab
octave_shift integer Adds or subtracts from the octave of all notes played in the pattern
scale string the name of a pre-defined Scale, used when evalating scale degree math in Slots
rate float the default tempo of the Song is multiplied by this value to get the effective tempo. With rate of 1, the notes in the Slots can be considered 1/16th notes. If the rate is 0.5, 1/8th notes. If the rate is 2, they are 32nd notes. It is also possible to set rate multipliers on the Scene and Clip. This value does not need to be a clean fraction.
direction string The name of the direction the pattern should run in. The default is 'forward'. Acceptable values are listed below. scale_type.
length int while not required, if set to a value less than the number of slots, only the first N slots will be used in the pattern. If longer, the pattern will loop around and play extra slots from the beginning.

Pattern Directions 

Valid values for direction are:
forward the pattern runs in a left to right direction
reverse the pattern runs in a right to left direction
oscillate the slots move left to right, then right to left
pendulum similar to 'oscillate', except the end notes are not repeated
random a random value is chosen from the slots list each time
serialized the pattern is shuffled, and then each slot is played in turn. When all slots are played, the slots are shuffled again
brownian1 a slot is chosen, and then the next slot to play will randomly be to the left or right. If a slot is chosen at the either end of the list, it will wrap around
brownian2 a slot is chosen, and the next slot will either be the same slot, or the one to the left or right
brownian3 same as brownian1 without the wrap-around behavior
brownian4 same as brownian2 without the wrap-around behavior
brownian5 same as brownian1 but the wrap around only happens on the right side
brownian6 same as brownian2 but the wrap around only happens on the right side
build the pattern plays left to right, but when the very last Slot is reached, that Slot value will repeat infintely. This is especially intended for use with Data Patterns

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


Suggestions & Tips 


In Context 

Reading the following API examples is recommended for understanding this section:

Next Up 

Now for the extra fun stuff. Time for Slots!