You are on page 1of 48

Code That Sounds Good:

Music Theory and Algorithmic Composition


nicolle neulist [rogueclown]

Notacon 9 April 1 ! "#1"

who is she! anyway$

two ma%or ho&&ies


computers singing music theory 'ocal per(ormance

musical training

spo)e at Notacon * a&out (ree so(tware (or music composition

what this tal) is

an introduction to &asic concepts and common (ramewor)s o( algorithmic composition

programming e+perience good! &ut not necessary

a tour o( the &asic &uilding &loc)s o( music theory

no musical training or music reading e+pected

an e+hi&it o( music theory and algorithmic composition in conte+t with each other

what this tal) isn,t

a detailed course on any gi'en programming language or algorithmic composition (ramewor)

there will &e some code e+amples! &ut (ocus will &e on language-independent concepts

a detailed course on music theory or musical (orms

music theory intro may &e re'iew (or some compositional choices (rom here on out are yours

the only way to do algorithmic composition

the roadmap

what is algorithmic composition$ (ree and open source tools and (ramewor)s music theory &asics ma)ing code out o( musical (orms ma)ing music out o( numerical data

what is algorithmic composition$

.Algorithmic composition is the application o( a rigid! well-de(ined algorithm to the process o( composing music/0

1Algorithmic composition as a model o( creati'ity/1 2ruce 3aco&/ 4rganised Sound! 'ol/ 1! no/ ! pp/ 156-175/ Cam&ridge 8ni'ersity 9ress/ :ecem&er 1997/

why algorithmic composition$

generate 'ariations on a theme or idea

%ump-start the traditional composition process

aurally interpret the patterns o( things


data sets mathematical e;uations pictures

algorithmic composition (ramewor)s and tools

why (ramewor)s$

any code that generates data that is interpreted in sound can wor)! in theory/// you could always come up with your own ar&itrary set o( mappings///

<and write all the li&raries to ma)e it tal) to a synthesi=er/>

M?:? is your (riend/

protocol to de(ine characteristics o( music notes understood and spo)en &y a wide range o( music so(tware and hardware lets you (ocus on your music! not the protocols

what language can i use$

you can do algorithmic composition in any language you want@ try se'eral (ramewor)s! and pic) an en'ironment where you,re most com(orta&le@

dedicated en'ironments (or algorithmic composition support the creation o( M?:? (iles most common languages ha'e one or more M?:? modules already written

dedicated algorithmic composition en'ironments

Common Music

http:AAcommonmusic/source(orge/netA programma&le in SAB or Scheme

AthenaCB

http:AAsource(orge/netApro%ectsAathenaclA 9ython-&ased! with its own system o( o&%ects

dedicated algorithmic composition en'ironments

CSound and CSoundAC


http:AAwww/csounds/comA programming language and sound synthesis engine CSoundAC: 9ython (ront-end to CSound

4penMusic

http:AArepmus/ircam/(rAopenmusicAhome Bisp-&ased 'isual en'ironment

li&raries (or general purpose languages

9ython

M?:?8til: http:AAcode/google/comApAmidiutilA many others a'aila&le on the 9ython wi)i: http:AAwi)i/python/orgAmoinA9ython?nMusic

3a'a

%Music: http:AAe+plodingart/comA%musicA 3Cugue: http:AAwww/%(ugue/orgA

li&raries (or general purpose languages

Du&y

3Sound::M?:?: http:AAru&ydoc/in(oAgithu&Aadam%murrayA%soundA masterA3SoundAMidi midi: https:AAru&ygems/orgAgemsAmidi midili&: https:AAru&ygems/orgAgemsAmidili&

9erl

M?:?: http:AAsearch/cpan/orgAEcon)linAM?:?-9erl#/*"Ali&AM?:?/pm search C9AN (or others

li&raries (or general purpose languages

other languages$

search the internet (or M?:? or music composition modules and li&raries in your language o( choice i( there is not a M?:? li&rary! create your own (unction to &uild M?:? data o(ten not necessary to implement the entire M?:? standard

code in this presentation

en'ironment (or the code e+amples:


language: 9ython M?:? li&rary: midiutil

principles apply no matter what language you choose

a short introduction to music theory

why music theory$

)nowing music theory gi'es you conte+t


what you hear what you create

learning (orms o( music doesn,t &ind you to them


what to adopt what to (lout

rhythm

&eats measures

groups o( &eats simple compound <symmetric> comple+ <asymmetric>

)inds o( meter

pitch and )ey

listen to a ma%or scale/

pitch and )ey

common pattern to a ma%or scale

two )eys to a whole step one )ey to a hal( step

play this pattern starting on any )ey! and you ha'e a ma%or scale@

pitch and )ey

set o( chords &uilt on each scale tone

%ust li)e with scales! you can mo'e the )ey patterns around the )ey&oard

common cadences <chord se;uences>


?-?F-F-? ii-F! ?F-F

where it (alls together

middle C is M?:? pitch 7# an increment o( 1 in M?:? num&ering is an increment o( 1 )ey on a )ey&oard &uilding scales and chords &ecomes simple addition and su&traction

turning musical (orms into code

(ollow the (orm///or not/

ma)ing creati'e choices in algorithmic composition


don,t (eel &ound &y any gi'en music theory idea i( you want your code to (ollow a certain musical paradigm! code that in/ i( you want your code to ignore or 'iolate a certain musical paradigm! code that in/ as) yoursel( what is re;uired &y the musical (orm as) yoursel( what is a compositional choice i made

loo)ing at my code

&uilding code to compose twel'e-tone music

what is twel'e-tone music$

introduced in the 19"#s &y Arnold Schoen&erg structured atonality

uses iterations o( the twel'e tones within an octa'e each must &e used once &e(ore any repeats &ased on a .tone row0

the tone row

a .tone row0 is some chosen ordering o( twel'e consecuti'e notes

M?:?: [n! nG1///nG11] user supplies &ase pitch ma)e tone row list shu((le it

process in the code

allowa&le iterations o( tone row

prime

&asic tone row tone row! re'ersed start (rom (irst note o( tone row re'erse each inter'al &etween notes in'ersion! re'ersed

retrograde

in'ersion

retrograde in'ersion

hear this in action@

prime retrograde in'ersion retrograde in'ersion

add a little comple+ity///

randomi=e which iteration plays

'ary note lengths

'ary the octa'e o( the notes

let,s ta)e another listen@

parameters:

(our iterations starting pitch: 75 all tone lengths </"5 &eats through 7 &eats> allowed

in the downloada&le code! you can change all these paramaters when you run it

///an e'en more comple+ e+ample

a streaming radio station that uses algorithmically composed twel'e-tone music &ased on the code (rom this tal) ma%or parameter it adds: polyphony station

http:AAwww/mina=o/netAlo'elyspam/html http:AAwww/mina=o/netAspammusicma)er/tar/g=

code

turning musical ideas into code


this is only the &eginning/ i( you (ind a musical (orm or idea that interests you:

loo) (or the mathematical underpinnings o( the (orm


pitch rhythm )ey harmony

create (unctions to manipulate those characteristics de'elop and twea) your (unctions until the generate music that sounds the way you want it to

using code to turn data into music

turning data into music

highlights why algorithmic music is still creati'e in nature

conscious choice (or how to map parts o( the dataset to musical parameters

no one way to do it

%ust one e+ample o( translating non-musical data into some )ind o( musical conte+t

choose a dataset

(or this case! chose a small and simple su&set o( a dataset! since this was e+planatory can always choose a larger dataset! with more parameters! to address other (actors

translate data to something musical

pitches

used ;uarter&ac) ratings shi(ted down &y 17 so entire melody wasn,t s)ewed so high used passing yards di'ided &y 1#!### and rounded! (or notes o( one to (i'e &eats

note lengths

hearing the data! in order

(ollows the same order in which the data points appeared gi'en how the data was presented <and how i interpreted it>! mostly a descending melody

randomi=ing the notes

each note pitch and length still corresponds to each ratingAyardage pair howe'er! the order is randomi=ed

what else to do with data$

alter other (actors o( the music! &ased on either other columns in a dataset or on ideas o( yours

harmonies )eys 'olumes instruments attac)Adecay o( notes

use a dataset with more points! (or a longer piece o( music

in conclusion///

remem&er: this is %ust a &eginning@ slides and code a'aila&le on my we&site

http:AAwww/rogueclown/net

any ;uestions$ contact me@


email: rogueclownHrogueclown/net Twitter: Hrogueclown

;uestions$ comments$ grie'ances$ catcalls$

You might also like