#Musical instructions
Ben Swift, School of Cybernetics
Lake Tuggeranong College STEM Camp
can y’all keep a secret?
enough about me…
tell me about you
#musicians?
#mathematicians?
#coders?
#talk
music, maths, computers — what’s the connection?
what are computer programs good at?
what would a song performed by a computer program sound like?
#outline
- what is (pop) music?
- activity: low-tech musical instructions
- livecoding: high-tech musical instructions
music (n.)
a series of pitched “events” over time
#pedantry alert
catchy hooks
repetitive harmonic patterns (e.g. chord progressions)
processed/synthetic sounds (lots of computers involved)
lots of patterns
but how do we express them?
#“dimensions” of a musical note
- time
- pitch
- loudness
#modelling the domain
remember: music is a series of musical events
each event has a time, a pitch and a loudness
#maths recap 1: functions
function f(x, y) takes two parameters and returns a result
e.g. f(x, y) = 8x + 2y
parameters are input; the function produces an output
#maths recap 2: modular arithmetic
arithmetic which “wraps around”
0, 1, 2, 0, 1, 2, 0, 1, 2, … instead of 0, 1, 2, 3, 4, 5, 6, …
the modulus can be any integer, e.g.
- 7 mod 4 is 3
- 18 mod 7 is 4
#example: clock
#patterns
#are
#everywhere
activity: musical instructions
#how to play
split into pairs
I’ll tell one person (person A) the name of a song
person A will write down (in English) instructions for how to play the song (no conventional music notation allowed)
person B will read the instructions, “sing” them, and try to guess what the song is
#scales (just a warm-up)
#Jaws
#We Will Rock You
remember: describe the instruments, not the vocal track
#This is America
#your choice of song
#talk
what was the hardest part?
what was the easiest?
was it easier/harder than you expected?
how would you do it differently next time?
#what I’m gonna do
learn a new song (by ear!)
figure out how to turn it into code
find sounds which sound (approximately) like the recording
lay down a vocal track (maybe)
make the whole process make sense to you
#what you’re gonna do
help me choose the song
be kind when I make mistakes
clap politely at the end (even if I flame out)
#reminder: domain model
time (in beats): 0, 1, 2, 3, 4, 5, 6, 7, 8
pitch (in MIDI note numbers): middle C as 60, C# as 61, etc.
loudness (0 is silent, 127 is super loud)
#extempore: a livecoding language
extempore is a programming language designed for musical livecoding (written by Andrew Sorensen and me)
mplay is the key function:
;; pitch loud duration instrument
(mplay *midi-out* 60 80 (* .5 dur) 1)don’t worry about the syntax — I’ll explain enough for you to follow
#I’m old…
#what did we learn?
pop music isn’t black magic — it’s a domain with lots of structure and patterns
we can write instructions which express those patterns
computers and code are really useful for modelling/exploring this stuff
this is not AI, either
#c/c/c studio
in 2020 I’m starting an art+music+code extension program at the ANU
we’ll do stuff like this (and lots more)
if you’re interested, let me know 😊
🤔