Form and sections
The form is the song’s list of sections: an intro, a groove, a break, a build, a drop. Each section has a kind, a length in bars, an energy, a progression, a drum variant, the tracks (layers) that play in it, and flags that ask the arranger for builds, gaps, impacts, fills and filter sweeps. This page says exactly what each one does.
form()
form([sec(...), sec(...), ...])
Replaces the whole form. Sections play in the order given. Two sections with the same name are renamed in order:
the second drop becomes drop2, the third drop3.
Every layer must be a track of the song, or one of the genre’s optional parts and loops (which may be absent from a
song, and are silent then). "*" and a missing layer list mean every track that exists when form() runs; tracks
added later join by the track() rule. Every section’s progression must exist, except
B, which a section plays as A on a song without one, and a bridge’s: a bridge that names a progression the
song does not have gets one of its own, written as form() runs (see sec()).
Errors: form() takes sec(...) items; section 'drop' uses 'snare', which is not a track (tracks: kick clap hat ohat shaker perc bass chords pad lead arp); section 'drop' plays progression 'C', which the song does not have (progressions: A B; prog() adds one).
form([
sec("intro", 8, "kick hat perc pad").filter_in(),
sec("groove", 16, "kick clap hat ohat perc bass chords"),
sec("break", 8, "pad chords lead"),
sec("build", 8, "clap hat pad lead").gap(),
sec("drop", 16, "*").impact(),
sec("outro", 8, "kick hat perc bass"),
]);
sec()
sec(kind, bars) // every track
sec(kind, bars, layers) // layers: "kick hat", ["kick", "hat"] or "*"
bars is an integer, clamped to 1..256. The kind is one of the words below; breakdown, chorus, loop and
middle_eight are accepted for break, hook, groove and bridge, and the section keeps the word you wrote as its
name.
Each kind comes with defaults:
| kind | energy | progression | drum variant | flags on |
|---|---|---|---|---|
intro | 0.4 | A | sparse | |
verse | 0.65 | A | main | |
groove | 0.65 | A | main | fills |
build | 0.6 | A | main | build |
drop | 0.95 | A | main | fills |
hook | 0.95 | A | main | fills |
break | 0.35 | B (A when there is no B) | main | |
bridge | 0.5 | bridge, its own | sparse | |
outro | 0.4 | A | sparse |
A bridge is somewhere the song has not been before it comes back. When the song has no progression of the name it
plays (bridge unless .prog() names another), form() writes one: it sets out away from the tonic (on the fourth or
the sixth of a major key, a minor key’s sixth, fourth or third), never plays the same chord twice in a row, and ends on
the dominant seventh of the chord the next section starts on, so that it leads into it; as many chords as its bars
take at the song’s bars_per_chord, two to eight. Every part plays it with notes of
its own, as each does every progression.
The kind also matters to the arranger (drops and hooks get crashes every 8 bars, a final outro closes a filter) and to the critic, which compares the loudness of drops and hooks with breaks.
Errors: unknown section kind 'party' (intro verse build drop break hook groove outro bridge); layers are a string ("kick hats") or an array of names.
Section methods
Each method returns a new section, so they chain: sec("drop", 16, "*").energy(1.0).impact().
| method | sets | values |
|---|---|---|
.name(s) | the section’s name, used by section(), layer() and the studio | string |
.energy(x) | the section’s energy | number, clamped to 0..1 |
.prog(name) | which progression it plays | any progression name |
.variant(name) | which drum-lane variant it plays | main, sparse, alt, half … |
.build() | a build into the next section | also .build(true), .build(false); .build(style) and .build(style, amount) choose how it builds, and styles stack: .build("roll+riser") |
.build_bars(n) | the bars at the section’s end the build-up takes | a whole number; 0 for each part’s own length |
.gap() | a beat of silence at the end | also takes true / false, or a number of beats: .gap(2) |
.impact() | a crash and an impact on the first beat | also takes true / false |
.fills() | drum fills at 8-bar phrase ends | also takes true / false |
.filter_in() | a lowpass opening across the section | also takes true / false |
.energy() raises energy needs a number for anything else. A variant that does not exist plays main. A
progression that does not exist is an error when form() gets the section, unless it is B (see above).
What the flags do
These are the exact rules of the arranger (compose::arrange). Several act on drum lanes only (the lanes written
by the generator or by drum()); pattern tracks are never rewritten, so a song made only of
patterns gets the risers, sweeps and crashes but no automatic rolls or fills.
The arranger finds lanes by their role. The fill lane is the first lane whose role is snare
(a lane named snare or sd, or one that plays a snare sound), or clap when there is none; the kick lane is the
first lane whose role is kick.
build
A build-up leads into the next section. How it builds is its style, .build(style), and how hard is its amount,
.build(style, amount), from 0 (gently) to 1 (as hard as it goes). .build() is classic at half, as every build
was before builds had styles. Styles stack with +: .build("roll+riser") plays the roll, the kick out and the
riser, all that each plays, and no sweep.
| style | plays |
|---|---|
classic | the roll, the kick out, the riser and the sweep below |
roll | the roll and the kick out: a drummer’s build |
sweep | the riser and the sweep, the drums playing on: a house or techno build |
riser | the riser alone |
drop_out | the riser, and every drum lane silent for the last bars: a pop or EDM song holding its breath |
- The roll. The fill lane stops its pattern for the last part of the section and plays a snare roll instead: quarter notes, then eighths, sixteenths and thirty-seconds, with velocity rising from 0.4 to 1.0. At half, the roll lasts half of the section’s first 8 bars, between 1 and 4 bars: 4 bars in an 8-bar build, 2 in a 4-bar one. The amount makes it 0.5 to 1.5 times that long (half a bar at least, the section at most), and its hits 0.7 to 1.3 times as loud (full at most). It is added even when the fill lane is not a layer of the section. A build that rolls has no fill at its end; one of another style keeps its fills.
- The kick out. The kick lane stops for the last bar; for none below an amount of 0.25, for two bars from 0.75.
- The riser. A riser plays over the last bars of the section: the genre’s riser length (8 bars in house, techno, dnb and future bass; 4 in deep house and synthwave), or the whole section if it is shorter, 0.5 to 1.5 times that by the amount, at a velocity from 0.6 (none) to 1.0 (half and more). Trap and lofi have no riser.
- The sweep. A highpass filter on the
musicandbassbuses sweeps from 10 Hz across the section and snaps back at the next one: to 900 Hz at half, 300 Hz at none, 2.7 kHz at the most. - The drums out. Every drum lane stops for the last bar at none, the last two at half, the last three at the most.
- Its bars.
.build_bars(n)gives the build-up the section’s lastnbars (the section at most): the roll, the riser and the sweep all take exactly those bars, whatever the amount, and the kick and the drums leave no earlier than they start. Without it, each part is as long as the style and the amount make it.
form([
sec("groove", 16, "*"),
sec("build", 8, "kick hat chords").build("sweep", 0.8), // a house build: the lows swept away, the drums on
sec("drop", 16, "*").impact(),
sec("verse", 16, "*").build("roll+riser").build_bars(4), // a roll and a riser over the verse's last 4 bars
sec("hook", 16, "*"),
]);
gap
In the section’s last beat, every track except the riser and the reverse crash is silent: notes that start there are
removed and notes that ring into it are cut. Audio loops keep playing. A gap before a drop makes the downbeat land
harder. .gap(beats) makes it that many beats long instead, from a sixteenth (0.25) to the whole section:
.gap(2) holds two beats of silence, .gap(0.5) an eighth note. A drummer’s fill ends where the gap starts.
impact
- A crash on the first beat, at full velocity.
- An impact hit and a downlifter, in genres that use them: house, techno, dnb and future bass have both; deep house has only the downlifter, trap only the impact, synthwave and lofi neither.
- A reverse crash over the last 2 beats of the section before, in genres that use it (all but techno and lofi).
fills
At the end of every 8-bar phrase, counted from the section’s start, the fill lane’s last 1 or 2 beats are replaced by a fill: a sixteenth-note roll, triplets, or a broken groove, at 85 % velocity. At about a third of those phrase ends, the kick drops out for the last half beat. A section shorter than 8 bars gets no fills, and a 12-bar section gets one, at bar 8.
filter_in
A lowpass filter on the music and bass buses opens from 350 Hz to 20 kHz across the section: the classic intro
that comes into focus. The drums are not filtered.
Without a flag
- Drops and hooks get a crash every 8 bars after their first bar, at velocity 0.7.
- A final outro (the last section, of kind
outro) closes a lowpass on themusicandbassbuses from 20 kHz, starting 40 % of the way in, down to 500 Hz at the end. - Every section starts its patterns from their first cycle and its progression from its first chord (see Patterns and time).
Energy
Energy is a number from 0 to 1 that says how intense a section is meant to be. It does not change the sound by itself; what plays decides that. It is used in three places:
- the critic checks that sections get louder where energy rises (the correlation between energy and measured loudness) and that the loudest drop or hook is at least 3 LU louder than the quietest break;
- new tracks made by
track()ordrum()join the sections with energy 0.6 or more; - the generator, when it builds a song around Apple Loops, layers the loops into sections by energy.
So set energies that match the layers: a break with three quiet tracks at 0.35, a full drop at 0.95.
section()
section(which, options) // which: a section name or a 0-based index
Edits one section. A name picks the first section with that name.
| field | type | effect |
|---|---|---|
bars | number | length, clamped to 1..256 |
energy | number | clamped to 0..1 |
prog, variant, name | string | as the methods above |
layers | string, array or "*" | replaces the layers |
build, gap, impact, fills, filter_in | bool | the flags; gap also takes a number of beats, which turns it on |
build_style, build_amount, build_bars | string, number, number | how the build-up builds (styles stack with +), how hard, 0 to 1, and the bars at the end it takes (0: each part its own length); a style or bars named turn the build-up on, unless build: false |
gap_beats | number | how long the gap lasts, in beats; turns the gap on, unless gap: false |
The section is checked as form() checks it: its layers must be tracks (or the genre’s optional parts and loops) and
its progression must exist. The map takes only the fields above.
Errors: no section 'nope'; no section 12; section() takes a name or an index; section 'drop' uses 'leed', which is not a track (tracks: ...); section 'break' plays progression 'Z', which the song does not have (progressions: A B; prog() adds one); no build-up 'swirl' (build-ups: classic, roll, sweep, riser, drop_out, or several with +, as roll+riser); a gap lasts some beats, more than none (0); section() has no option 'bar' (options: bars energy prog variant name layers build build_style build_amount build_bars gap gap_beats impact fills filter_in).
section("drop", #{ energy: 1.0, layers: "kick clap hat bass chords lead" });
section(0, #{ bars: 16, filter_in: true });
layer()
layer(section, track, on) // section: name or 0-based index; on: bool
Switches one track on or off in one section, without touching the others. The track must exist, or be one of the genre’s optional parts or loops.
Errors: no section 'nope'; layer() takes a section name or index; no track 'leed' (tracks: ...).
layer("break", "lead", false);
layer("intro", "shaker", true);