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

Clips


Clips

Clips are how we load lists of Patterns into Scenes and Tracks. If you are familiar with popular GRID-based DAW programs, clips sit and the intersection of scenes and tracks. They work the same here, but they also have some additional parameters and behavior.



Creating A Clip 

Clips must be assigned to a scene and track pair at creation time:

api.clips.add(name='reset demo', scene='scene_1', track='lead', scales=['C-major'], patterns=['resetting'],
              transforms=[], repeat=8, auto_scene_advance=True)

A clip has the following properties:

Property Type Description
name string A symbolic name for the scene, as referenced from a Clip
scene string The name of a previously defined scene to add this clip to
track string The name of the track where events from this clip are routed
patterns list of strings A list of pattern names to play in order. All patterns in the list will always play, and pattern names may be repeated.
tempo_shifts list of integers A list of tempo offsets (in BPM) to add to the current tempo. Each index in the list cycles as each pattern advances. This can be used to construct builds and slowdowns. If the end of the list is reached, the values will wrap around
next_clip string If set and auto_scene_advance is not set, the named clip will be activated after this clip finishes. This clip does not need to be on the same track.
transforms list of strings A list of Transforms to apply. As the patterns advance, the transforms chosen per pattern also advance to the next item in the list. More than one transform can be applied if the list element is, instead of a string, a list of transform names. These are demoed throughout the API Examples
repeat int If set, all patterns will repeat N times before the clip will end. If None, the patterns will loop forever until the scene is ended by another pattern that is set to auto_scene_advance.
auto_scene_advance bool if True, the completion of all patterns (subject to repeat) will trigger the next scene in the list to play automatically, stopping all clips in the current scene
scales list of strings a list of Scale names. As the patterns advance, each scale from the list will also advance in turn. If not supplied, the scale will be drawn from the Scene, or if not there, the Song.
rate int If set, multiplies the effective BPM of the clip by this value. 0.5 will interpret all patterns in this clip as 1/8th notes instead of 16th notes, etc.
  As a reminder, this is reference material, see the API Examples for all of this put together.

Suggestions & Tips 


In Context # 

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

Next Up 

We are ready to learn how to learn how to start the Event Loop though you may also wish to learn about Transforms if you haven't done so already.