Musical instructions

Dr Ben Swift

Lake Tuggeranong College STEM Camp

musicians? mathematicians? coders?

what’s the connection?

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

lots of patterns

catchy hooks, repetitive harmony, processed sounds

but how do we express them?

dimensions of a note

time · pitch · loudness

maths recap: functions

a function f(x, y) takes inputs and returns an output

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

maths recap: modular arithmetic

arithmetic that “wraps around”: 0, 1, 2, 0, 1, 2, …

7 mod 4 is 3 · 18 mod 7 is 4

activity: musical instructions

how to play

split into pairs

person A writes down — in English — how to play a song (no music notation)

person B reads the instructions, “sings” them, and guesses the song

talk

what was the hardest part? the easiest?

harder or easier than you expected?

now the high-tech version

extempore is a livecoding language for music; mplay is the key function:

;;                pitch loud duration   instrument
(mplay *midi-out* 60    80   (* .5 dur) 1)

what did we learn?

pop music isn’t black magic — it’s a domain with structure and patterns

we can write instructions that express those patterns

code is really useful for exploring this — and it’s not AI

🤔

[email protected]