First Noise

EDM.0 — the part where you make sound come out of the computer

Strudel is a live coding instrument in your browser. Type a pattern, press play, and sound comes out. No install. Runs in a tab.

Every code block below is a live editor. Change anything, hit the play button, hear what breaks. That’s the whole method.

how to read this page

Play the code first. Listen. Then read the text around it. The sound comes before the name. Always.

01Your First Sound

Hit play.

one kick drum, one cycle, forever

A kick drum. s() plays a sample. "bd" is that sample’s name: bass drum.

tweak it

Swap bd for sd (snare), hh (hi-hat), cp (clap), or oh (open hat). Hit play after each change.

Now line up a few:

four sounds, one cycle

Four sounds, evenly spaced. Strudel carves one cycle into equal slots. More sounds, less time each. Fewer sounds, more time each.

tweak it

Pack it: s("bd sd hh oh cp mt lt ht"). Then strip it back to two. Hear the timing shift.

pattern

What you just played is a pattern: events spread across a repeating cycle. Sounds, notes, effects: everything in strudel is a pattern. The cycle is the clock.

02The Pattern Language

The text inside the quotes is mini-notation, a tiny language for shaping patterns. Five tools.

Brackets: subdivide a slot

Cram two sounds where one used to be. [ ] splits a slot’s time between everything inside.

slot two now holds two sounds
tweak it

Nest them: s("bd [sd [hh hh]] oh cp"). Brackets inside brackets. Each level subdivides further.

Multiply: repeat fast

*8 crams the sound in eight times, all within one cycle. Hi-hat rolls come from this.

eight hats in one cycle

Rest: leave a gap

Tilde ~ holds a slot open but plays nothing. Without gaps, everything runs together. The rest gives each hit space.

kick, gap, snare, gap

Euclidean: let math place the hits

(3,8) distributes three kicks as evenly as possible across eight slots. The math picks the spacing. It ends up sounding good because even distribution tends to.

three in eight — euclidean
tweak it

Try (5,8), (3,4), (7,16), (2,5). Different numbers, different feel. Some of these are West African and Afro-Cuban rhythms, centuries old.

rabbit hole — euclidean rhythms, the algorithm, and 500 years of rhythm

E(3,8): the tresillo

Hear that pattern you just played? That’s the tresillo. Three hits, eight slots, spaced as evenly as possible.

What you’re looking at is a rhythm necklace: a circular pattern where rotation doesn’t change the shape, only where beat 1 falls. Every row in the table above is a different necklace. The tresillo and the son clave are the same necklace, worn differently.

The algorithm

Distribute 3 hits across 8 slots as evenly as possible. The gaps between hits can only ever be two sizes (here, 3 and 2). That’s maximal evenness.

[x . . x . . x .]

Where these patterns show up

patternnametraditionvibe
(3,8)TresilloCuban / West AfricanThe backbone of Afro-Cuban music. Claves, cowbell, bass.
(5,8)CinquilloCuban contradanzaTresillo’s denser cousin. Timbales, guiro.
(3,4)CumbiaColombian / PersianNearly full: three hits, one gap.
(7,12)West African bellAshanti / Yoruba / EweThe standard bell pattern. Everything else plays around it.
(5,16)Bossa novaBrazilianTwo bars of floating syncopation.
(7,16)SambaBrazilianDense, driving agogo bell pattern.

Rotation

(3,8,2) is the same three hits, started from a different position. Same necklace, different downbeat. The tresillo and the son clave are rotations of each other. Same math, different groove.

rotation comparison — same hits, different start

Angle brackets: alternate per cycle

< > rotates through its options, one per cycle. Snare, clap, snare, clap.

snare on odd cycles, clap on even
mini-notation — the short version

[ ] subdivide • *N multiply • ~ rest • (k,n) euclidean • < > alternate

Five tools. Every rhythm you’ve heard uses some combination of these.

03Stack It

One pattern at a time gets old. Music is layers.

three patterns at once

Kick on 1 and 3. Clap on 2 and 4. Hi-hats throughout. You just built a drum beat.

tweak it

Swap the hat for s("hh*16"). Make the kick euclidean: s("bd(3,8)"). Stack as many layers as you want.

Now add pitch. note() plays notes:

drums + bass

C in the second octave. .s("sawtooth") swaps the sample for a synthesizer, a raw buzzy wave. .lpf(500) chops the harsh highs. .decay() and .sustain(0) make it short and punchy.

rabbit hole — samples vs synths, wave shapes, and filters

Samples vs synths

s() plays a recording. Someone hit a drum, we play it back. note() generates a wave from scratch. No recording, just math. Samples sound “real.” Synths sound “electronic.” Both are patterns.

Wave types

wavesoundcode
sinepure, clean, sub-bass.s("sine")
sawtoothbright, buzzy, leads + bass.s("sawtooth")
squarehollow, woody, chiptune.s("square")
trianglesoft, muted, gentler saw.s("triangle")

Filters

A filter removes frequencies. .lpf(500) = low-pass filter at 500hz. Everything above 500hz gets cut. The number is the cutoff. Lower number = darker sound. Higher = brighter.

filterdoescode
lpfcuts highs (low-pass).lpf(500)
hpfcuts lows (high-pass).hpf(200)
cutoff passes cut frequency → volume LPF cutoff cut passes frequency → volume

Envelope (ADSR)

An envelope shapes a sound over time. Four stages:

stagecontrolscode
attackhow fast the sound starts.attack(0.01)
decayhow fast it drops from peak.decay(0.1)
sustainlevel it holds at (0–1).sustain(0.5)
releasehow fast it fades after stopping.release(0.3)
sustain level attack decay sustain release

.sustain(0) with a short .decay() = a pluck. No sustain, instant drop.

method chaining

Chain effects with dots: note("c2").s("sawtooth").lpf(500). Each one adds something: sound, filter, envelope. Order barely matters.

04Your First Loop

Everything from this lesson, combined. Play it, wreck it, rebuild it until it sounds like yours. Then hit share.

// TITLE: first noise
compose — make it yours
  1. Rewrite the bass line. Try note("<c2 [c2 eb2] f2 [eb2 c2]>")
  2. Add a layer (a euclidean clap): s("cp(3,8)").gain(.4)
  3. Alternate the hats: s("<hh*8 hh*16>")
  4. When it sounds right, hit the share button. Day 1 post.
what you earned
tooldoeslooks like
s()plays a sample by names("bd sd hh")
note()plays a pitched note through a synthnote("c2 eb2")
stack()layers patterns on top of each otherstack(s("bd"), s("hh*8"))
[ ]subdivides a slot (crams sounds in)s("bd [sd sd]")
*Nrepeats a sound N times in one slots("hh*8")
~rest — holds the slot silents("bd ~ sd ~")
(k,n)euclidean — distributes k hits across n slotss("bd(3,8)")
< >alternates options, one per cycles("bd <sd cp>")
.method()chains effects onto a pattern.lpf(500).gain(.5)
.s()sets the sound source (sample or synth type).s("sawtooth")
.gain()sets volume (0 to 1+).gain(.5)
.lpf()low-pass filter — cuts frequencies above cutoff.lpf(500)
.decay()how fast the sound drops from peak.decay(.15)
.sustain()level the sound holds at after decay.sustain(0)
sawtootha bright, buzzy synthesizer wave.s("sawtooth")

Next: The Break — 170bpm, half-time snare, an actual DnB beat.

mini-notation reference
syntaxnamedoesexample
[ ]bracketssubdivides a slots("bd [sd sd]")
*Nmultiplyrepeats N times in one slots("hh*8")
~restsilence, holds the slots("bd ~ sd ~")
(k,n)euclideandistributes k hits across n slotss("bd(3,8)")
(k,n,r)euclidean + rotationsame but rotated r stepss("bd(3,8,2)")
< >alternateone option per cycle, rotatings("bd <sd cp>")
/Nslowstretches pattern across N cycless("[bd sd hh oh]/2")
!Nreplicaterepeats without changing speeds("bd!3 sd")
?degrade50% chance of silences("hh*8?")