Patterns loop; a shred proceeds. A do-block is a little score that walks forward through musical time, turning knobs and firing notes on schedule.
clock = do { bright := 0.2; wait 8beats; bright := 0.9 } — set a macro, wait eight beats, set it again. The shred launches with the transport and runs alongside every pattern.
loop do { … } repeats its body forever; times 4 do { … } a set number of times. A loop of waits and sets is a step-sequencer for knobs.
trigger bell ~E5 2beats vel: 0.6 fires a single voice of any patch — no track needed. Shreds can play punctuation the patterns don't loop.
A macro can also follow a looping pattern lane: m := !"0.2 0.8 0.5" inside a shred drives it stepwise, in time, until the next set.
The starting point#
The lesson opens with this song in the editor. Every edit recompiles and plays.
-- Shreds: a knob exists, but nobody's hands are on it. Write the performance.
bright = macro 0.4
pluck = patch {
source = saw (freq pitch),
ampEnv = adsr 1ms 150ms 0 90ms,
cutoff = 400Hz + bright * 4000Hz,
gain = vel * 0.5
}
chime = patch {
source = triangle (freq pitch),
ampEnv = adsr 1ms 400ms 0 600ms,
gain = vel * 0.4
}
line = play pluck !"c2 c2 eb2 c2 g2 c2 bb1 eb2"
What to watch#
A shred moves the sound on its own schedule. Watch the spectrum's edge step at the moments the do-block says, not on the pattern grid.
Goals#
The workbench checks these as you work; the solution is there when you want it.
- A do-block that waits and turns a knob
- Loop it
- Stretch: fire a voice from the score
Make it yours#
Write a shred that performs YOUR filter sweep: closed for 8 beats, snap open for 2, half-closed for 6 — looped. Then add a chime trigger at the snap.
Further reading#
Timed live processes in the reference.