On this page:
1.1 Basic Note Loading
1.2 Manipulating Notes
1.3 Making A Track
1.4 Writing Rhythms
1.4.1 Basic Tuplets
1.4.2 More Complex Tuplets
1.4.3 Reusing Tuplets
1.4.4 Other Rhythmic Forms
1.4.4.1 Patterns
1.4.4.2 Polyrhythms
1.5 Pattern Note Loading
1.6 Exporting
8.17.0.1

1 Tutorial🔗ℹ

This is a tutorial that’ll allow you to get started with Tuplet. It assumes you already have Tuplet installed, so if you haven’t yet done that, follow the instructions in the appropiate section of the README.md file. Make sure you’ve imported Tuplet with (require tuplet).

1.1 Basic Note Loading🔗ℹ

In tuplet, an individual sound clip is referred to as a "note".

Notes can be loaded with (load [some-file-path]). They be given a name with (let [note-name] (load [some-file-path])).

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))

You must provide the correct path to the audio file (either absolute or relative to the file you’re using Tuplet in), and the audio file must be in WAV format.

1.2 Manipulating Notes🔗ℹ

Once a note is loaded, you can perform various manipulations on it. Doing this creates a copy of the note with the change applied, so you must give it a new name. The original note should be unchanged.

There are several note manipulation functions included in Tuplet. As an example, let’s use pitch.

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))
(let snare-pitched (pitch snare 2))
1.3 Making A Track🔗ℹ

You can define a new track with (track [track-name] [bpm] [measure] ...).

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))
(let kick-pitched (pitch kick 2))
 
(track demo_track 130
       ...)
1.4 Writing Rhythms🔗ℹ

Let’s add a couple measures.

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))
(let kick-pitched (pitch kick 2))
 
(track demo_track 130
       (4 kick snare kick snare)
       (4 kick snare kick snare))

Each of these measures take up 4 beats, as marked by the 4 at the start of the measure. These measures have a simple rhythm that matches this music notation:

two measures of music notation in 4/4: quarter notes alternating between kick and snare

1.4.1 Basic Tuplets🔗ℹ

Let’s add a note to the second measure, so we can match this music notation:

two measures of music notation in 4/4: first measure is quarter notes alternating between kick and snare, second measure is quarter note kick, quarter note snare, eighth note kick, eighth note kick, quarter note snare

If we add another kick to the measure, we get this code:

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))
(let kick-pitched (pitch kick 2))
 
(track demo_track 130
       (4 kick snare kick snare)
       (4 kick snare kick kick snare))

But, it sounds completely wrong! This is because measures in Tuplet are actually treated as musical tuplets, meaning the above code actually translates to this music notation:

two measures of music notation in 4/4: first measure is quarter notes alternating between kick and snare, second measure is a quintuplet containing the pattern kick, snare, kick, kick, snare

In order to get what we actually want, we need the two adjacent kicks to be treated as a single beat. To do this, we use another tuplet:

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))
(let kick-pitched (pitch kick 2))
 
(track demo_track 130
       (4 kick snare kick snare)
       (4 kick snare (1 kick kick) snare))

This illustrates an important thing about Tuplet: a lot of your rhythmic notation will be accomplished with tuplets. I wonder where this language got its name...

It’s also really easy to write weird and complex rhythms with Tuplet, maybe even if you didn’t intend to. In some ways, Tuplet makes the hard thing easy (nested tuplets) and the easy thing hard (basic rhythms).

1.4.2 More Complex Tuplets🔗ℹ

Let’s add another measure. Because measures are represented as tuplets, we can simply change the number of beats to change time signatures.

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))
(let kick-pitched (pitch kick 2))
 
(track demo_track 130
       (4 kick snare kick snare)
       (4 kick snare (1 kick kick) snare)
       (7 kick snare kick snare (2 kick kick kick) snare))

We’ve now easily added a new measure in 7/4! Also notice how, by fitting three kick drums into two beats, we were able to create quarter note tuplets. This track now corresponds to the following rhythm:

two measures of music notation in 4/4 followed by a measure in 7/4. the 7/4 measure contains a quarter note tuplet on the kick drum

And, of course, we can get even more complex. In Tuplet, tuplets can be nested indefinitely, and can contain any number of notes. You can even make a tuplet that represents a fraction of a beat–the number of beats does not have to be a whole number! You can make some insanely weird stuff in Tuplet, so feel free to mess with it!

1.4.3 Reusing Tuplets🔗ℹ

Like notes, tuplets can be used in a let expression to give them names and reuse them. The below example is functionally equivalent to the previous one.

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))
(let kick-pitched (pitch kick 2))
(let triplet-kick (2 kick kick kick))
 
(track demo_track 130
       (4 kick snare kick snare)
       (4 kick snare (1 kick kick) snare)
       (7 kick snare kick snare triplet-kick snare))
1.4.4 Other Rhythmic Forms🔗ℹ

Musical tuplets aren’t the only form in Tuplet. There are a couple of other ways you can sequence notes that you may find helpful. Notes, tuplets, and the below forms, as a whole, are called "oneshots".

1.4.4.1 Patterns🔗ℹ

Patterns are groupings of notes that aren’t assigned a number of beats. This makes them functionally equivalent to simply placing them without grouping them in a pattern. This makes them useful for giving a name and reusing them nested inside different tuplets. You can put tuplets in patterns and patterns in tuplets! To add a pattern, simply omit the number of beats.

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))
(let kick-pitched (pitch kick 2))
(let triplet-kick (2 kick kick kick))
(let ksks (kick snare kick snare))
 
(track demo_track 130
       (4 ksks)
       (4 kick snare (1 kick kick) snare)
       (7 ksks triplet-kick snare))
1.4.4.2 Polyrhythms🔗ℹ

Polyrhythms allow you to layer multiple patterns, possibly each with a different number of beats. Note that because Tuplet doesn’t allow multiple sounds to play simutaneously by default, if notes are in sync, the latter one will take precedent. To add a polyrhythm, use a : instead of a number of beats. Polyrhythms will always be treated as if they are a single beat, so place them in tuplets if you want to extend/shorten them.

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))
(let kick-pitched (pitch kick 2))
(let triplet-kick (2 kick kick kick))
(let ksks (kick snare kick snare))
(let ksks2 (: (kick kick kick kick) (snare snare)))
(let three-two (: (kick kick kick) (snare snare)))
 
(track demo_track 130
       (4 ksks)
       (4 kick snare (1 kick kick) snare)
       (7 ksks triplet-kick snare)
       (7 (4 ksks2) (2 three-two) snare))
1.5 Pattern Note Loading🔗ℹ

Let’s say you have a drum loop you want to splice and use for a track. Using Tuplet, you can define a pattern with names that match the rhythm of the loop, and Tuplet will splice the clip for you. In a way, it’s like writing a track, in reverse.

Note that the loop must strictly conform to a rhythmic grid, else clips will not slice properly.

Here’s a (pretty complex) example:

(let (k1 k2 s1 (3 h1 s2 h2 s3 k3 k4) s4 (1 r1 r2)
         k5 k6 s5 (3 h3 s6 h4 s7 (2 s8)) (2 h5))
  (load "./samples/cw_amen02_165.wav"))
 
(track demo_pattern_bind 150
       (4 k1 s1 k2 s1)
       (4 k1 s4 (k1 k1) h5))
1.6 Exporting🔗ℹ

Let’s listen to a track you’ve made! You can use play! to play a track. And we can save it to a WAV file with save!.

(let kick (load "./samples/kick.wav"))
(let snare (load "./samples/snare.wav"))
(let kick-pitched (pitch kick 2))
(let triplet-kick (2 kick kick kick))
(let ksks (kick snare kick snare))
(let ksks2 (: (kick kick kick kick) (snare snare)))
(let three-two (: (kick kick kick) (snare snare)))
 
(track demo_track 130
       (4 ksks)
       (4 kick snare (1 kick kick) snare)
       (7 ksks triplet-kick snare)
       (7 (4 ksks2) (2 three-two) snare))
 
 
(play! demo_track)
(save! demo_track)

And that’s the basics! Feel free to read the reference documentation, or just play around with it! Have fun!