The Mathematics of Rhythm

Music & Math Using Supercollider

Elliott Grabill

The Mathematics of Rhythm by Elliott Grabill is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, except where otherwise noted.

Contents

- 1. The Mathematics of Rhythm

- Appendix A: Diagram of Western Musical Notation

- Appendix B: Diagram of Western Musical Notation Rests

- Appendix C: Latin Rhythms

- Works Cited

1

The Mathematics of Rhythm

A YouTube element has been excluded from this version of the text. You can view it online here: https://ubalt.pressbooks.pub/musicandmathsupercollider/?p=39

The above video contains a demonstration for setting up and playing music on SuperCollider.

First, download this Rhythm Lesson Worksheet.

Then, download SuperCollider: https://supercollider.github.io/download

After you download the Rhythm Lesson Worksheet and SuperCollider, you will also need to download the instrument files linked below.

Tom

Bass Drum

Cowbell 1

Cowbell 2

Tambourine

Snare

Copy and paste the text below into a blank SuperCollider document. Replace all of the lines starting with “/Users/elliottgrabill/Documents…” by clicking and dragging the downloaded audio files (as shown in the above video demonstration).

//HIGHLIGHT “s.boot” and press SHIFT + ENTER. s.boot;

//DOUBLE CLICK to the right of the “(” below. Press SHIFT + ENTER.

(

//Tom

= Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER Files/Tom.wav”

);

//Bass Drum

= Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER AudioFiles/Bass Drum.wav”

);

// Cowbell 1

= Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER Files/Cowbell

1.wav”

);

// Cowbell 2

= Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER AudioFiles/Cowbell 2.wav”

);

//Tambourine

= Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OERFiles/Tambourine.wav”

);

// Snare

= Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER AudioFiles/Snare.wav”

);

SynthDef(“normal”, {

arg amp = 1, bufnum = 0, rate = 1.066666667, loop = 0, ffreq = 1000, rel = 10; var snd;

var env = Env.new([0, 5, 1, 0], [0.01, 16, 6],[-5, 0, 3]);

var envgen = EnvGen.ar(env, doneAction: 2);

snd = PlayBuf.ar( numChannels: 2, bufnum: bufnum, rate: rate, loop: loop ) * envgen * amp;

Out.ar([0, 1], snd);

}

).add;

~mySynth = Synth(“normal”, [\bufnum, a, \amp, 0.1, \rel, 10]);

)

// EXAMPLE 1

~drum = Pbind(

\instrument, “normal”,

\bufnum, a,

\dur, Pseq([

1, 0.33333, 0.33333, 0.33333, 1, 2,

1, 2

], 15),

\rate, 1

).play;

// EXAMPLE 2

~drum = Pbind(

\instrument, “normal”,

\bufnum, a,

\dur, Pseq([

2, 2, // MEASURE 1

0.5, 0.5, 2.5, 0.5 // MEASURE 2

], 15),

\rate, 1

).play;

// EXAMPLE 3

// TWO RHYTHMS AT THE SAME TIME

t = TempoClock(144/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 0.33333, 0.33333, 0.33333, 1, 2,

1, 2

], 5),

\rate, 1

).play(t);

~drum = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

1.5, 2.5,

1.5, 2.5

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 4

// cCHANGING THE TEMPO

t = TempoClock(144/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 1, 0.5, 1,

0.5, 0.5, 0.5, 0.5, 0.5

], 5),

\rate, 1

).play(t);

~drum = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

1.5, 1.5,

1.5, 1.5

], 5),

\rate, 1

).play(t);

}.fork(t);

1

Appendix A: Diagram of Western Musical Notation

Kristin Conlin

Name

Symbol

Duration

May also look like:

Comments

Whole note

4

Dotted half note

3

Half note

2

Dotted quarter note

1.5

Quarter note

1

Dotted eighth (8th) note

0.75

Dotted 8th note + 16th note

Eighth note (8th)

0.5

Two 8th notes

Triplet eighth (8th) note

.33333

Three triplet 8th notes

Sixteenth (16th) note

0.25

Four 16th notes

Thirty-second (32nd) note

0.125

Four 32nd notes

2

Appendix B: Diagram of Western Musical Notation Rests

Name

Symbol

Duration

Whole rest

4

Dotted half rest

3

Half rest

2

Dotted quarter rest

1.5

Quarter rest

1

Dotted eighth (8th) rest

0.75

Eighth (8th) rest

0.5

Triplet eighth (8th) rest

0.33333

Dotted sixteenth (16th) rest

0.25

Thirty-second (32nd) rest

0.125

3

Appendix C: Latin Rhythms

s.boot;

(

//Tom

a = Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER Files/Tom.wav”

);

//Bass Drum

b = Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER Audio Files/Bass Drum.wav”

);

// Cowbell 1

c = Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER Audio Files/Cowbell 1.wav”

);

// Cowbell 2

d = Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER Audio Files/Cowbell 2.wav”

);

//Tambourine

e = Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER Audio Files/Tambourine.wav”

);

// Snare

f = Buffer.read(s, “/Users/elliottgrabill/Documents/Paper Documents/Math/OER Audio Files/Snare.wav”

);

SynthDef(“normal”, {

arg amp = 1, bufnum = 0, rate = 1.066666667, loop = 0, ffreq = 1000, rel = 10;

var snd;

var env = Env.new([0, 5, 1, 0], [0.01, 16, 6],[-5, 0, 3]);

var envgen = EnvGen.ar(env, doneAction: 2);

snd = PlayBuf.ar(

numChannels: 2,

bufnum: bufnum,

rate: rate,

loop: loop

) * envgen * amp;

Out.ar([0, 1], snd);

}

).add;

~mySynth = Synth(“normal”, [\bufnum, a, \amp, 0.1, \rel, 10]);

)

// EXAMPLE 1

// SIMPLE

~drum = Pbind(

\instrument, “normal”,

\bufnum, a,

\dur, Pseq([

1, 1, 0.5, 0.5, 1,

2, 1, 1

], 15),

\rate, 1

).play;

// EXAMPLE 2

// CHA CHA

t = TempoClock(120/60);

{

~cowbell = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 1, 1, 1

], 5),

\rate, 1

).play(t);

~drum = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

1, 0.5, 0.5, 1, 0.5, 0.5

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 3

// RUMBA

t = TempoClock(184/60);

{

~cowbell = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 0.5, 1, 1, 0.5,

1, 1, 0.5, 1, 0.5

], 5),

\rate, 1

).play(t);

~drum = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

1.5, 2, 1.5,

1, 2

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

1.5, 2.5,

4

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 4

// MAMBO

t = TempoClock(184/60);

{

~cowbell = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 0.5, 1, 0.5, 0.5, 0.5,

1, 1, 0.5, 1, 0.5

], 5),

\rate, 1

).play(t);

~drum = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

1.5, 1.5, 2,

1, 2

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

1.5, 1.5, 2.5,

1.5, 1,

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 5

// NEW YORK MOZAMBIQUE

t = TempoClock(184/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 1, 0.5, 1, 1,

0.5, 1, 0.5, 1, 0.5

], 5),

\rate, 1

).play(t);

~drum = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

3.5, 2,

1.5, 1

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

7.5, 0.5

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 6

// SONGO

t = TempoClock(144/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5

], 5),

\rate, 1

).play(t);

~drum = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

1, 1.5, 1, 0.5

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

1.5, 1.5, 1

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 7

// NANIGO

t = TempoClock(144/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 1, 0.5, 1,

0.5, 0.5, 0.5, 0.5, 0.5

], 5),

\rate, 1

).play(t);

~drum = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

1.5, 1.5,

1.5, 1.5

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 8

// MOZAMBIQUE

t = TempoClock(184/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 1, 0.5, 1, 1,

0.5, 1, 0.5, 1, 0.5

], 5),

\rate, 1

).play(t);

~cowbell1 = Pbind(

\instrument, “normal”,

\bufnum, d,

\dur, Pseq([

1.5, 1.5, 2.5,

1.5, 1

], 5),

\rate, 1

).play(t);

~cowbell2 = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

2, 4,

2

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

2, 4,

2

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 8

// SALSA

t = TempoClock(108/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

0.5, 0.5, 0.25, 0.5, 0.25,

0.5, 0.25, 0.5, 0.25, 0.25, 0.25

], 5),

\rate, 1

).play(t);

~drum = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

0.5, 0.5, 1,

0.75, 0.75, 0.5

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

0.75, 2, 0.75, 0.5

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 9

// SAMBA

t = TempoClock(182/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5,

0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5

], 5),

\rate, 1

).play(t);

~cowbell = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

1, 1.5, 1, 1,

1, 0.5, 1, 1

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

1.5, 0.5, 1.5, 0.5,

1.5, 0.5, 1.5, 0.5

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 10

// BOSSA NOVA

t = TempoClock(182/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 1, 1, 1,

1, 1, 1, 1

], 5),

\rate, 1

).play(t);

~cowbell = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

1.5, 1.5, 2,

1.5, 1.5

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

1.5, 0.5, 1.5, 0.5,

1.5, 0.5, 1.5, 0.5

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 11

// BAIAO

t = TempoClock(182/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1.5, 0.5, 1.5, 0.5,

1.5, 0.5, 1.5, 0.5

], 5),

\rate, 1

).play(t);

~cowbell = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

0.5, 0.5, 1.5, 0.5, 1.5,

0.5, 2, 1

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

1.5, 1.5, 1,

1.5, 1.5, 1

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 12

// PARTIDO ALTO

t = TempoClock(108/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

0.5, 1.5, 0.5, 0.5, 1,

1, 1, 0.5, 0.5, 1

], 5),

\rate, 1

).play(t);

~cowbell = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

1, 3.5,

2.5, 1

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

2.5, 1, 2.5,

1, 1

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 13

// BATUCADA

t = TempoClock(182/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, a,

\dur, Pseq([

1, 2, 2,

2, 1

], 5),

\rate, 1

).play(t);

~cowbell1 = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

1.5, 0.5, 1.5, 0.5,

1.5, 0.5, 1.5, 0.5

], 5),

\rate, 1

).play(t);

~cowbell2 = Pbind(

\instrument, “normal”,

\bufnum, c,

\dur, Pseq([

2, 1.5, 1,

1, 0.5, 2

], 5),

\rate, 1

).play(t);

~cowbell2 = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

0.5, 0.5, 0.5, 1, 0.5, 0.5, 0.5,

0.5, 0.5, 0.5, 1, 0.5, 0.5, 0.5,

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 14

// BEGUINE

t = TempoClock(144/60);

{

~snare = Pbind(

\instrument, “normal”,

\bufnum, f,

\dur, Pseq([

0.5, 1, 1, 1, 0.5

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

2, 1, 1

], 5),

\rate, 1

).play(t);

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

1, 1, 1, 1

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 15

// TANGO

t = TempoClock(108/60);

{

~snare = Pbind(

\instrument, “normal”,

\bufnum, f,

\dur, Pseq([

1, 1, 1, 2,

1, 1, 1

], 5),

\rate, 1

).play(t);

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

1, 1, 1, 1,

2, 1, 1

], 5),

\rate, 1

).play(t);

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

3.5, 0.25, 0.25, 3.5, 0.25, 0.25

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 15

// BOLERO

t = TempoClock(96/60);

{

~snare = Pbind(

\instrument, “normal”,

\bufnum, f,

\dur, Pseq([

0.5, 0.166667, 0.166667, 0.166666,

0.5, 0.166667, 0.166667, 0.166666,

0.5, 0.5,

0.5, 0.166667, 0.166667, 0.166666,

0.5, 0.166667, 0.166667, 0.166666,

0.166667, 0.166667, 0.166666, 0.166667, 0.166667, 0.166666

], 5),

\rate, 1

).play(t);

}.fork(t);

// EXAMPLE 16

// REGGAE

t = TempoClock(120/60);

{

~tambourine = Pbind(

\instrument, “normal”,

\bufnum, e,

\dur, Pseq([

0.66667, 0.33333, 0.66667, 0.33333,

0.66667, 0.33333, 0.66667, 0.33333

], 5),

\rate, 1

).play(t);

2.wait;

~bassdrum = Pbind(

\instrument, “normal”,

\bufnum, b,

\dur, Pseq([

4

], 5),

\rate, 1

).play(t);

}.fork(t);

4

Works Cited

Mattingly, Rick. All About Drums: A Fun and Simple Guide to Playing Drums. Milwaukee: Hal Leonard Corporation, 2006.

Roberts, Gareth E. From Music to Mathematics: Exploring the Connections. Baltimore: Johns Hopkins University Press, 2016.

Ruviero, Bruno. A Gentle Introduction to SuperCollider. Licensed under the Creative Commons Attribution-ShareAlike 4.0 International License, 2015 edition.