Skip to content

Arrange a Song from Sections

A section holds every track’s lane for a stretch of the song; arrange() puts sections in sequence. Every method is in the audio reference. The Arrangement Model explains how sections, lanes and layers relate. For a guided first song, see Arrange a Song.

section(length) makes a section length cycles long. Index it with a track and send the lane a pattern:

use "std/instruments" { Sampler, Kit };
let drums = AudioTrack("drums");
drums.set_instrument(Sampler(Kit("CR-78")));
let bass = AudioTrack("bass");
bass.set_instrument(Sampler(Kit("CR-78")));
let verse = section(8);
verse[drums] << [bd bd sd bd];
verse[bass] << [c2 _ g1 _];

verse[drums].at(start, duration) << pattern places a pattern inside the lane instead of covering the whole section.

.clone() copies a section, every lane included. Change the copy:

let chorus = verse.clone();
chorus[drums] << [bd sd bd sd];

arrange(#[...]) plays its elements back to back. elem * n repeats one, and an arrangement can be an element of another:

let song = arrange(#[verse * 2, chorus]); // verse 0–16, chorus 16–24

song.play() starts the song from the top and plays it once through:

song.play();

Every lane edit you make afterwards is heard while it plays; you don’t call play() again.

show(song) prints every lane as it will play — one row per stretch, with the layer that wins it:

show(song);

song[drums].entries() lists what you wrote on a lane instead, and flags writes that are completely hidden as masked.