2. The grid

I. Making music

The grid

Most of the music the studio makes keeps a steady pulse, and everything in a song is placed against it: where a drum hits, when a chord changes, how long a note lasts. This chapter is about that pulse and the grid the studio lays over it: beats, bars, the drums that mark them, swing, which pushes the grid out of square, and rhythms made by spreading hits evenly over it.

Open the window on the chapter's first song, in the editor:

zig build run-studio -- manual/02-grid/kick --view editor

Beats and bars

A beat is the pulse you tap your foot to, and the tempo counts how many come in a minute: at 120 BPM, the tempo in the top bar here, a beat lasts half a second. The studio groups beats in fours, and four beats make a bar. Every song in the studio is in 4/4, four quarter-note beats a bar, the meter of nearly all pop and dance music.

A kick drum on every beat, two bars of it. Drum Edit shows the clip's one bar, a row for each of the drum machine's voices and a column for each 16th note. Listen for eight even thumps, half a second apart.: the drums

0.0 / 4.0 s

peak -17.4 dBFS

Fig. 2.1 A kick drum on every beat, two bars of it. Drum Edit shows the clip's one bar, a row for each of the drum machine's voices and a column for each 16th note. Listen for eight even thumps, half a second apart.

openzig build run-studio -- manual/02-grid/kick --view editor

renderzig build run-studio -- render manual/02-grid/kick kick.wav

kick/song.json
{
  "tempo": 120,
  "end": "3",
  "devices": [{ "name": "808", "type": "drums" }],
  "tracks": [
    { "name": "drums", "device": "808", "channel": 1, "role": "drums", "clips": [{ "at": "1", "length": "2.0.0", "notes": "kick" }] }
  ],
  "notes": {
    "kick": {
      "length": "1.0.0",
      "notes": ["1.1.0 C2 0.0.240 120", "1.2.0 C2 0.0.240 110", "1.3.0 C2 0.0.240 116", "1.4.0 C2 0.0.240 110"]
    }
  }
}

The studio writes a place in a song as bar.beat.tick, counting bars and beats from 1: 1.1.0 is the first beat of the first bar, and 1.3.0 its third. A beat holds 960 ticks, so 1.2.480 is halfway through the second beat, the place a drummer counts as "and": one and two and three and four and. The song position in the top bar reads the same way as the song plays.

This is Drum Edit, which the editor shows for a drum track. Its columns are 16th notes, a quarter of a beat each: four columns make a beat, and sixteen a bar. A hit sits on a column, and draws taller the harder it's struck. A click on an empty step adds a hit, at velocity 120 in the step's upper half and 96 in its lower half, both an accent on the drum machine (its book); a click on a hit takes it away, and a drag along a row paints a hit on every step it crosses. Each row has its own grid, the 1/16 at the right of its name, which a click steps, and Q pulls each row's hits onto its grid.

A kick on every beat is called four on the floor, and it's the floor that house and techno stand on.

The kick, the snare, and the hats

A beat is mostly three sounds in three jobs. The kick, the bass drum, marks the beat. The snare, or a clap in its place, answers it on beats 2 and 4: the backbeat, which you clap along to. The hi-hats, a pair of cymbals clamped shut or let ring open, divide the beat into smaller steps.

House: the kick on every beat, a clap on 2 and 4, and an open hi-hat on every off-beat. Listen for the hat between each pair of kicks.: the drums

0.0 / 3.9 s

peak -9.7 dBFS

Fig. 2.2 House: the kick on every beat, a clap on 2 and 4, and an open hi-hat on every off-beat. Listen for the hat between each pair of kicks.

openzig build run-studio -- manual/02-grid/house --view editor

renderzig build run-studio -- render manual/02-grid/house house.wav

house/song.json
{
  "tempo": 122,
  "end": "3",
  "devices": [{ "name": "808", "type": "drums" }],
  "tracks": [
    { "name": "drums", "device": "808", "channel": 1, "role": "drums", "clips": [{ "at": "1", "length": "2.0.0", "notes": "house" }] }
  ],
  "notes": {
    "house": {
      "length": "1.0.0",
      "notes": [
        "1.1.0 C2 0.0.240 120", "1.1.480 A#2 0.0.240 84",
        "1.2.0 C2 0.0.240 110", "1.2.0 D#2 0.0.240 104", "1.2.480 A#2 0.0.240 80",
        "1.3.0 C2 0.0.240 116", "1.3.480 A#2 0.0.240 84",
        "1.4.0 C2 0.0.240 110", "1.4.0 D#2 0.0.240 104", "1.4.480 A#2 0.0.240 80"
      ]
    }
  }
}

The open hat on every "and", halfway between the kicks, is house's: it lifts each beat off the floor. Move it onto the beats and the beat sits down; take the clap away and it loses its backbeat.

A rock beat at 100 BPM: the kick on 1 and 3 and the "and" of 3, the snare on 2 and 4, and the closed hat on every eighth note, louder on the beats.: the drums

0.0 / 4.8 s

peak -13.4 dBFS

Fig. 2.3 A rock beat at 100 BPM: the kick on 1 and 3 and the "and" of 3, the snare on 2 and 4, and the closed hat on every eighth note, louder on the beats.

openzig build run-studio -- manual/02-grid/backbeat --view editor

renderzig build run-studio -- render manual/02-grid/backbeat backbeat.wav

backbeat/song.json
{
  "tempo": 100,
  "end": "3",
  "devices": [{ "name": "808", "type": "drums" }],
  "tracks": [
    { "name": "drums", "device": "808", "channel": 1, "role": "drums", "clips": [{ "at": "1", "length": "2.0.0", "notes": "backbeat" }] }
  ],
  "notes": {
    "backbeat": {
      "length": "1.0.0",
      "notes": [
        "1.1.0 C2 0.0.240 120", "1.1.0 F#2 0.0.240 96", "1.1.480 F#2 0.0.240 72",
        "1.2.0 D2 0.0.240 110", "1.2.0 F#2 0.0.240 90", "1.2.480 F#2 0.0.240 72",
        "1.3.0 C2 0.0.240 116", "1.3.0 F#2 0.0.240 96", "1.3.480 C2 0.0.240 100", "1.3.480 F#2 0.0.240 72",
        "1.4.0 D2 0.0.240 110", "1.4.0 F#2 0.0.240 90", "1.4.480 F#2 0.0.240 72"
      ]
    }
  }
}

Rock moves the kick off half the beats and leaves the snare on 2 and 4. The closed hat ticks in eighth notes, every other column, and its hits on the beats are louder than those between: an accent, which tells the ear where the beat is even when the kick is silent.

The letter keys play the drum machine too, two octaves lower than a synth, so the home row starts at C2: A is the bass drum, S the snare, E the clap, T the closed hat, and U the open hat. The names in Drum Edit's rows are the keys' names, and List Edit, the third of the editor's modes, shows every hit as the line song.json holds:

1.2.0 D#2 0.0.240 104

a hit's place, its key, its length, and how hard it's struck, from 1 to 127.

Swing

Straight 16ths split each eighth note exactly in half. Swing pushes the second of each pair of 16ths later, so the pairs go long-short: a lope rather than a march. The studio's swing says where the second 16th starts, as a share of the pair, from 50%, straight, to 75%.

16th hats with a kick and a snare at 92 BPM, two bars straight and two at 66% swing. The picture is in the third bar, where the top bar reads `swing 66%`. Listen for the hats starting to lope halfway through.: the bar 16th hats with a kick and a snare at 92 BPM, two bars straight and two at 66% swing. The picture is in the third bar, where the top bar reads `swing 66%`. Listen for the hats starting to lope halfway through.: the drums

0.0 / 10.4 s

peak -13.5 dBFS

Fig. 2.4 16th hats with a kick and a snare at 92 BPM, two bars straight and two at 66% swing. The picture is in the third bar, where the top bar reads swing 66%. Listen for the hats starting to lope halfway through.

openzig build run-studio -- manual/02-grid/swing --view editor --play 1

renderzig build run-studio -- render manual/02-grid/swing swing.wav --from 1 --to 5

swing/song.json
{
  "tempo": 92,
  "swing": ["1 50", "3 66"],
  "end": "5",
  "devices": [{ "name": "808", "type": "drums" }],
  "tracks": [
    { "name": "drums", "device": "808", "channel": 1, "role": "drums", "clips": [{ "at": "1", "length": "4.0.0", "notes": "sixteenths" }] }
  ],
  "notes": {
    "sixteenths": {
      "length": "1.0.0",
      "notes": [
        "1.1.0 C2 0.0.240 120", "1.1.0 F#2 0.0.120 92", "1.1.240 F#2 0.0.120 60", "1.1.480 F#2 0.0.120 80", "1.1.720 F#2 0.0.120 60",
        "1.2.0 D2 0.0.240 110", "1.2.0 F#2 0.0.120 92", "1.2.240 F#2 0.0.120 60", "1.2.480 F#2 0.0.120 80", "1.2.720 C2 0.0.240 96", "1.2.720 F#2 0.0.120 60",
        "1.3.0 F#2 0.0.120 92", "1.3.240 C2 0.0.240 108", "1.3.240 F#2 0.0.120 60", "1.3.480 F#2 0.0.120 80", "1.3.720 F#2 0.0.120 60",
        "1.4.0 D2 0.0.240 110", "1.4.0 F#2 0.0.120 92", "1.4.240 F#2 0.0.120 60", "1.4.480 F#2 0.0.120 80", "1.4.720 F#2 0.0.120 60"
      ]
    }
  }
}

At 66%, the second 16th of each pair starts two thirds of the way through it, close to a triplet: at 92 BPM, 52 ms after it would straight. Drum Edit still draws every hit on its column, because swing changes when the grid's 16ths play, not where the notes are. Every note on a second 16th moves, the hats and the kicks on 1.2.720 and 1.3.240 alike, and every note on a beat or an "and" stays put.

The swing is in the top bar beside the tempo, and the wheel over it steps it a percent. A song can change it from bar to bar; this one's song.json holds "swing": ["1 50", "3 66"], straight from bar 1 and swung from bar 3. Hip hop's boom bap swings around 58%, UK garage's two-step around 56%, and house anywhere from straight to the 60s.

Euclidean rhythms

Take eight steps and three hits, and spread the hits as evenly as they go: x..x..x., a hit, two rests, a hit, two rests, a hit, a rest. That's the tresillo, the 3 + 3 + 2 at the bottom of Cuban music, reggaeton, and a great deal of pop. Godfried Toussaint showed in 2005 that spreading k hits over n steps this way, by the algorithm Eugen Bjorklund wrote for a particle accelerator's timing, finds rhythms from all over the world. He named them by Euclid, whose algorithm for the greatest common divisor works the same way.

The kick as `euclid 3 8` writes it: the tresillo in 16ths, twice a bar, under eighth-note hats and a clap on 2 and 4.: the drums

0.0 / 4.8 s

peak -12.0 dBFS

Fig. 2.5 The kick as euclid 3 8 writes it: the tresillo in 16ths, twice a bar, under eighth-note hats and a clap on 2 and 4.

openzig build run-studio -- manual/02-grid/tresillo --view editor

renderzig build run-studio -- render manual/02-grid/tresillo tresillo.wav

tresillo/song.json
{
  "tempo": 100,
  "end": "3",
  "devices": [{ "name": "808", "type": "drums" }],
  "tracks": [
    { "name": "drums", "device": "808", "channel": 1, "role": "drums", "clips": [{ "at": "1", "length": "2.0.0", "notes": "tresillo" }] }
  ],
  "notes": {
    "tresillo": {
      "length": "1.0.0",
      "notes": [
        "1.1.0 C2 0.0.240 100", "1.1.0 F#2 0.0.240 90", "1.1.480 F#2 0.0.240 70", "1.1.720 C2 0.0.240 100",
        "1.2.0 D#2 0.0.240 100", "1.2.0 F#2 0.0.240 84", "1.2.480 C2 0.0.240 100", "1.2.480 F#2 0.0.240 70",
        "1.3.0 C2 0.0.240 100", "1.3.0 F#2 0.0.240 90", "1.3.480 F#2 0.0.240 70", "1.3.720 C2 0.0.240 100",
        "1.4.0 D#2 0.0.240 100", "1.4.0 F#2 0.0.240 84", "1.4.480 C2 0.0.240 100", "1.4.480 F#2 0.0.240 70"
      ]
    }
  }
}

Drum Edit makes them. A click on a row's name, such as C2 bass drum, drops a list of ways to fill the row over the clip: every 1/4, every 1/8, every 1/16, off-beats, 2 and 4, and euclid. Up and Down try each one as they step to it, playing it in the song; Enter writes it, as one edit, and Esc puts the row back. Over euclid, the wheel sets the hits, Shift and the wheel the steps, up to 32, and Ctrl and the wheel turns the rhythm round, starting it on another of its steps. Its steps are 16ths, repeated over the clip, so euclid 3 8 plays the tresillo twice a bar, as above. The list names the rhythms Toussaint found:

Hits and steps Pattern Name
3 of 4 xxx. cumbia
3 of 8 x..x..x. tresillo
5 of 8 x.xx.xx. cinquillo
7 of 12 x.xx.x.xx.x. West African bell
5 of 16 x..x..x..x..x... bossa nova
7 of 16 x..x.x.x..x.x.x. samba

Bossa nova's and samba's are usually played turned round, starting on another hit, which is what Ctrl and the wheel is for. Put a Euclidean rhythm on a rim shot or a cowbell over a straight kick, and it pulls against the beat without leaving it.

Beats by style

The drum machine has beats of its own, without writing a hit. Its second group holds twelve to start from, each named for its style: house, deep house, techno, electro, boom bap, breakbeat, two-step, dembow, trap, funk, half-time, and synth-pop, then four fills, a snare roll, a tom run, a build, and a stop. The first group holds the 808's own, from rock and disco to bossa and march.

A pattern clip plays one of them. Ctrl and a double-click on an empty spot of a drum track places one a bar long, playing the program the track's row shows, such as 2-1A: group 2, rhythm 1, variation A. A click on that program drops the list, which names each rhythm, as 2-1A house. A rhythm that wants a swing the song doesn't have says so, as boom bap wants 58% swing, and picking it again sets the song's swing.

Try it in the window

  • Open manual/02-grid/kick in the editor and turn it into the house beat: a clap on 2 and 4, and an open hat on the off-beats, from the fill list on each row's name.
  • Play the backbeat with the letter keys over the kick: S on 2 and 4, T in eighths. Press C for the click if you want one.
  • In the swing song, set the swing anywhere from 50% to 75% with the wheel, and find where the hats stop loping and start limping.
  • Fill a rim shot row with euclid and step the hits and the steps with the wheel until the list names a rhythm. Turn it with Ctrl and the wheel.
  • Start a song from the boom bap template, Ctrl+N and boom bap, select its drum clip, and pick group 2's beats from the program list one after another.

Next: chapter 3, keys, the notes a song is made of.