I’m always looking for ways of making music with my computer that feels natural to me and fits with my mental model of music creation. As part of that search, I decided to try learning TidalCycles. Tidal is a language embedded into Haskell and designed to write and manipulate patterns to create music.

After getting set up and tinkering for a bit, I decided to try using Tidal to create an intentional piece of music. Tidal’s focus on patterns made me think of another musician obsessed with patterns and repetition, Steve Reich. That connection planted a seed in my mind, and I decided to try recreating Steve Reich’s Clapping Music with Tidal:

The meat of my implementation is in these three statements that describe the shifting rhythm:


repeatCycles 4
$ iter "12"
$ n "0 0 0 ~ 0 0 ~ 0 ~ 0 0 ~"

We start with our base pattern (n "0 0 0 ~ 0 0 ~ 0 ~ 0 0 ~"). Next, we use iter to split that pattern into the twelve variations we’ll play throughout the piece. However, we want to repeat each variation for some number of cycles before moving onto the next. It turns out that repeatCycles is a nice way of accomplishing this. We repeat each variation for four cycles before moving onto the next.

Because we’re repeating each variation of our pattern for four cycles, we’ll want to use seqP to sequence 13 * 4 cycles of both rhythms to start and end our piece in unison:


seqP [
  (
    0,
    13 * 4,
    ...
  ),
  (
    0,
    13 * 4,
    ...
  )
]

When using seqP, it’s important to resetCycles to make sure we start on cycle 0.

And that’s all there is to it! It’s simple in hindsight, but I spent quite a while figuring this out, and learned from many mistakes along the way. The end result was worth it. Rock on, Steve Reich.