Downspout Algorithms

This note summarizes the main generation and processing methods used by the current Downspout plugins.

MIDI generators

Audio effects

MIDI effects

Instruments

Launchpad plugins

Plugins driven by, or giving LED feedback to, a Launchpad grid.

Appendix: Ground Algorithm Detail

Ground generates a monophonic bass part in three passes: first it plans the form, then it generates phrase-local note events, then it folds the resulting notes into a guarded bass register.

1. Form And Phrase Planning

The structural grid comes from Form Shape, Form, Phrase, and the current meter. With Form Shape = Free, Ground uses the user-selected Form and Phrase lengths directly. A common setting is Form = 16 and Phrase = 4, which creates four four-bar phrase slots. Named shapes such as blues, fugue, AABA, dub, ambient, and rondo override those lengths with fixed templates.

Each phrase receives a PhraseRoleId:

For Free shapes, the first phrase is normally Statement, the final phrase is usually Cadence or Release, and the middle phrase roles are chosen from Tension, Cadence, Sequence, phrase position, and deterministic seeded randomness. Manual phrase-role overrides bypass that role choice for selected phrase slots while keeping the rest of the phrase generation pipeline intact.

After role selection, each phrase stores:

2. Scale Degrees And Root Movement

Ground works in scale degrees first, not raw MIDI notes. For F harmonic minor, the pitch collection is:

degree: 0  1  2   3   4  5   6
pitch:  F  G  Ab  Bb  C  Db  E

Degrees can move outside 0..6. For example, degree -1 is the E below F, degree 7 is the next F, and degree 8 is the next G. Only after the degree is chosen does Ground convert it to a MIDI note using the selected root, register, phrase register offset, and octave.

Phrase roles choose different root targets. In the generic planner:

The exact choice is seeded, so the same saved state reproduces the same result.

3. Rhythm And Onset Generation

Each phrase builds a small boolean onset grid. Ground uses four internal steps per beat, so a normal 4/4 bar has 16 steps. The Style control lays down the basic rhythmic feel, then the role adds pickups, cadential hits, or extra off-beat material.

For Style = Descend, each bar starts with anchors at:

step 0  : bar start
step 8  : half-bar
step 12 : late-bar anchor when Motion is high enough, or for cadences
step 4  : optional beat-2 anchor, based on Density and Motion
step 14 : optional late pickup when Color or cadence behavior asks for it

Statement, Climb, Cadence, and Release then adjust that grid. For example, Climb may add a mid-bar push at step 6 or 14, while Release may keep the phrase more open.

4. Degree Choice Inside A Descending Phrase

For the Descend style, the pitch contour is explicitly falling through the phrase. Ground computes phrase progress from the local step, then derives a descent amount from Motion, Color, and elapsed phrase position.

In simplified terms:

descent ~= floor(progress * (3 + Motion * 3 + Color * 1.5))

The role then modifies that falling line:

This is why a Descending style does not simply override every role into the same falling scale. Role still matters; Descend changes how each role moves.

5. Duration, Legato, And Register Guard

Once an onset has a degree, Ground chooses a duration up to the next onset. Note Length sets the cap, Note Length Variation adds seeded variation, and style/role modify the preferred value. Descend leans longer than ostinato, march, jazz, or rock. Release, Pedal, and Cadence also get extra legato.

Adjacent repeated notes can be merged into a longer event. After all events are generated, notes are folded into the selected bass lane:

This final pass is why a high computed degree may still sound as a controlled bass-register pitch.

Example: F Harmonic Minor, Free Shape, Descending Style

Assume:

Root: F
Scale: Harmonic Minor
Style: Descend
Shape: Free
Form: 16 bars
Phrase: 4 bars
Phrase roles: Statement, Climb, Climb, Release

With four-bar phrases, the 16-bar form has four phrase slots:

bars  1-4  : Statement
bars  5-8  : Climb
bars  9-12 : Climb
bars 13-16 : Release

One seeded form might choose root degree targets like this:

Phrase 1 Statement: degree 0  -> F
Phrase 2 Climb    : degree 4  -> C
Phrase 3 Climb    : degree 5  -> Db
Phrase 4 Release  : degree 0  -> F

The exact targets can vary by seed, but the role pools stay the same. In F harmonic minor, the useful degrees around those targets are:

around F : F, E, Db, C, Bb, Ab
around C : C, Bb, Ab, G, F, E
around Db: Db, C, Bb, Ab, G, F

So the example has this larger shape:

At a phrase level, this can sound like a bass that keeps falling locally while the form itself still rises into the two Climb phrases before settling. That is the intended interaction between Role = Climb and Style = Descend: the role sets phrase energy and target area, while the style determines the local contour.