Shawarma

Strudel drum patterns

Drums are the quickest way into Strudel: one line of mini-notation is a whole beat. This page starts with the grid, then builds common grooves step by step, then adds variation so the loop keeps changing. New to the code? Read the tutorial first; it takes ten minutes.

The drum names

Drum sounds have short names. These are the ones used below:

bd
bass drum (kick)
sd
snare drum
hh
closed hi-hat
oh
open hi-hat
cp
clap
rim
rimshot
lt, mt, ht
low, mid and high tom
cr
crash cymbal
rd
ride cymbal
cb
cowbell
sh
shaker

Each has a few recordings; add :1, :2 and so on to pick another (bd:3).

The grid

A pattern fills one cycle, and in most music a cycle is one bar of four beats. Write sixteen steps and each step is a sixteenth note, like the sixteen buttons on a drum machine. ~ is an empty step.

s("bd ~ ~ ~ sd ~ ~ ~ bd ~ bd ~ sd ~ ~ ~")
Kick on beat 1, snare on 2, kick on 3 and just after it, snare on 4.

Sixteen steps get long to read. Most patterns below use shorter forms: bd*4 for four kicks, [~ hh] for "nothing, then a hat", and a comma between layers.

Four on the floor

A kick on every beat. This is the base of house, techno and disco.

s("bd*4")

Add a clap on beats two and four, the backbeat:

s("bd*4, ~ cp ~ cp")

Hi-hats

Hats set the feel. Eighth notes keep time evenly:

s("bd*4, hh*8")

Hats only between the beats give the off-beat bounce of house music:

s("bd*4, [~ hh]*4")

Sixteenth notes with a volume pattern sound played rather than programmed. The four values repeat four times per cycle, one per hat:

s("bd*4, hh*16").gain("[.9 .5 .7 .5]*4")

House

Four kicks, claps on two and four, off-beat hats and an open hat on the last beat. This is the drum part of the House groove template in Shawarma.

setcpm(31) // 124 BPM

s("bd*4, [~ cp]*2, [~ hh]*4, ~ ~ ~ oh")

Rock and pop

A kick on one and three, a snare on two and four, an extra kick just after beat three, and straight eighth-note hats:

setcpm(28) // 112 BPM

s("bd ~ ~ ~ sd ~ ~ ~ bd ~ bd ~ sd ~ ~ ~, hh*8")

Boom bap

A slower hip-hop beat, at 90 BPM. swing(4) delays every second hat in each beat, which gives the lazy, shuffled feel. Each layer is on its own line, so the swing applies to the hats only.

setcpm(90/4) // 90 BPM

stack(
  s("bd ~ ~ bd ~ ~ bd ~ ~ ~ bd ~ ~ ~ ~ ~"),
  s("~ ~ ~ ~ sd ~ ~ ~ ~ ~ ~ ~ sd ~ ~ ~"),
  s("hh*8").gain("[.8 .5]*4").swing(4),
)

Breakbeat

Syncopated kicks and snares that land off the beat. Here the kick and snare parts use eight steps per cycle, and [~ sd] at the end adds a ghost snare just before the loop comes round.

setcpm(34) // 136 BPM

s("bd ~ ~ bd ~ ~ bd ~, ~ ~ sd ~ ~ sd ~ [~ sd], hh*8")

Euclidean rhythms

(3,8) after a sound spreads 3 hits as evenly as possible over 8 steps. Many traditional rhythms are made this way: 3 over 8 is the Cuban tresillo, 5 over 8 the cinquillo. A third number rotates the pattern.

s("bd(3,8), hh(5,8), rim(2,8,3)")

The same as a function, here 5 cowbell hits over 16 steps:

s("cb").euclid(5, 16)

Variation

A loop that never changes gets tiring. A ? after a step drops it at random half the time, so the hats change every bar:

s("bd*4, hh*16?")

degradeBy sets how often: .3 drops about 30% of the hits.

s("bd*4, hh*16").degradeBy(.3)

Fills

A fill marks the end of a phrase. With !3 inside angle brackets, a bar plays three times and then the fill bar plays once:

s("<[bd ~ sd ~]!3 [bd sd [sd sd] [sd sd sd sd]]>, hh*8")

Or change the last bar with a function. ply(2) plays every hit twice:

s("bd ~ sd ~, hh*8").lastOf(4, x => x.ply(2))

A tom run in every fourth bar, over a steady kick:

s("<~ ~ ~ [lt mt ht ht]>, bd*4")

And a crash at the start of every four bars, which tells the listener a new phrase has begun:

s("bd*4, [~ cp]*2, [~ hh]*4, <cr ~ ~ ~>")

Beyond the drum kit

Any sound works the same way. This is maqsum, one of the most common rhythms in Arabic music, on a darbuka: dum, tek, rest, tek, dum, rest, tek, rest. Two recordings of the drum stand in for the low stroke (dum) and the high one (tek).

setcpm(27.5) // 110 BPM, maqsum: dum tek - tek dum - tek -

stack(
  s("darbuka:0").struct("x ~ ~ ~ ~ ~ ~ ~ x ~ ~ ~ ~ ~ ~ ~"),
  s("darbuka:4").struct("~ ~ x ~ ~ ~ x ~ ~ ~ ~ ~ x ~ ~ ~").gain(.6),
)

The Maqam groove example builds a full piece on a darbuka pattern, and the cheat sheet lists every mini-notation symbol used here.

Try it in Shawarma

Shawarma is a music editor where every song is code. Your song plays on a loop; ask the assistant for a change in plain words, listen to it, and keep it only if you like it. Or edit the code yourself, as in this guide. The editor is free, with 5 assistant replies to try it; Pro starts with 7 days free.