Skip to content

Your First Groove

On this page you build one drum groove with the rest of mini-notation — the symbols inside a pattern’s brackets. At the end, you read a dense pattern at a glance.

Start with Pattern Basics. Write each step into src/main.non, select it, and press Cmd+Enter. Every step adds to what the previous one built.

Finish Pattern Basics. Open src/main.non, evaluate RESET; on its own, then remove that line. Check that the earlier drums and bass are silent. The setup below makes a new drums track; evaluate later blocks in order.

use "std/instruments" { Sampler, Kit };
let drums = AudioTrack("drums");
drums.set_instrument(Sampler(Kit("TR-808")));
drums << [bd sd bd sd];
PLAY;

Put a pattern inside a step, and it divides only that step:

drums << [bd sd bd [sd sd]];

The last step plays two snares, each half as long. Go one level deeper:

drums << [bd sd bd [sd [sd sd]]];

The last half of the last step divides again: a small roll into the next bar. The groups need not be the same size — [bd [sd sd sd]] puts a triplet in the second half.

Each layer of a comma divides the cycle by its own number of steps:

drums << [bd bd bd, cp cp];

Three kicks against two claps: they meet only on the downbeat. Now a real groove in three layers:

drums << [bd _ bd _, _ sd _ sd, ch ch ch ch];

Angle brackets inside a step change only that step, cycle by cycle:

drums << [bd _ bd _, _ sd _ <sd [sd sd]>, ch ch ch ch];

The last snare is single in one cycle and double in the next.

*n plays a step n times in its own slot:

drums << [bd _ bd _, _ sd _ <sd [sd sd]>, ch*8];

Eight hi-hats, with one symbol instead of eight steps.

@n gives a step n shares of the cycle instead of one:

drums << [bd@3 sd, ch*8];

The kick holds three quarters of the cycle, and the snare comes late, on the last quarter.

!n writes a step n times, as if you had typed it out:

drums << [bd!3 sd, ch*8];

[bd!3 sd] expands to [bd bd bd sd]: four equal steps. Unlike *, ! adds steps to the sequence, so all four divide the cycle anew.

/n stretches a step over n cycles:

drums << [bd sd, ch*8, <_ oh>/2];

The open hat alternates with silence, but each choice now lasts two cycles.

^ sets a hit’s velocity, from 0 to 127:

drums << [bd sd, ch^120 ch^60 ch^80 ch^60 ch^120 ch^60 ch^80 ch^60];

The hi-hats get louder and softer in a pattern of their own.

drums << [bd <sd [sd sd]>, ch*8, <_ oh>];

Read it comma by comma:

  • bd <sd [sd sd]> — a kick, then a snare that is single in one cycle and double in the next.
  • ch*8 — eight closed hi-hats.
  • <_ oh> — an open hi-hat in every second cycle.
STOP;