Musical instructions

Dr. Ben Swift

22 May '19

can y’all keep a secret?

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)

what is music?

music (n.)

a series of pitched “events” over time

what is (pop) music?

catchy hooks

repetitive harmonic patterns (e.g. chord progressions)

processed/synthetic sounds (lots of computers involved in the production)

lots of patterns

but how do we express them?

1. time
2. pitch
3. loudness

time

what aspects of the music does it influence?

why is it important?

how do we measure it?

pitch

what aspects of the music does it influence?

why is it important?

how do we measure it?

loudness

what aspects of the music does it influence?

why is it important?

how do we measure it?

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/arguments and returns a result

e.g. f(x, y) = 8x + 2y

parameters are input, the function does something with the inputs to produce 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

so let's find them

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

We Will Rock You

remember: you have to describe the instruments, not the vocal track

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 a bunch of sounds which sound (approximately) like the recording

lay down a vocal track (maybe)

make the whole process make sense to you guys

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), e.g. 0, 1, 2, 3, 4, 5, 6, 7, 8

pitch (in MIDI note numbers), e.g. 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 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 along

what did we learn?

pop music isn’t black magic, it’s a domain with lots of structure/patterns

we can write instructions which express those patterns

computers/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 😊

🤔

[email protected]

https://benswift.me