algorithmic composition: computational thinking in...

9
Algorithmic Composition: Computational Thinking in Music DRAFT Michael Edwards Reader in Music Technology School of Arts, Culture and Environment University of Edinburgh Edinburgh, UK http://uofe.michael-edwards.org [email protected] ABSTRACT Despite the still-prevalent but essentially nineteenth century perception of the Western creative artist, an algorithmic ap- proach to music composition has been in evidence in Western classical music for at least one thousand years. The history of algorithmic composition—from both before and after the invention of the digital computer—will be presented along with specific techniques and musical examples from the dis- tant and recent past. Keywords Algorithmic Composition, Computer-aided Composition, Au- tomatic Composition, Computer Music, Stochastic Music, Xenakis, Ligeti, Lejaren Hiller. 1. INTRODUCTION In the West, the layman’s vision of the creative artist is largely bound in romantic notions of inspiration sacred or secular in origin. Images are plentiful; for example, a man standing tall on a cliff top, the wind blowing through his long hair (naturally), waiting for that particular iconoclastic idea to arrive through the ether. 1 Tales, some even true, of genii penning whole operas in a matter of days, further blur the reality of the usually slowly-wrought process of composition. Mozart, with his speed of writing, is a famous example who to some extent fits the clich´ e, though perhaps not quite as well as legend would have it. 2 1 I’m thinking in particular of Caspar David Friedrich’s painting From the Summit, in the Hamburg Kunsthalle. 2 Mozart’s compositional process is a complex and often misunderstood matter, complicated by myth—especially re- garding his now refuted ability to compose everything in his head [12, 104]—and Mozart’s own statements such as “I must finish now, because I’ve got to write at breakneck Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Copyright 200X ACM X-XXXXX-XX-X/XX/XX ...$10.00. That composition should include calculation 3 and, from the perspective of the non-specialist, seemingly arbitrary, uninspired technique or formal development, can lead to dis- appointment on the part of those casually interested in the subject. What we shall see is that calculation has been part of the Western composition tradition for at least a thousand years. This paper will outline the history of algorithmic composition from the pre- and post-digital computer age, concentrating in particular, but not exclusively, on how it developed out of the avant-garde Western classical tradition in the second half of the twentieth century. This survey will be more illustrative than all-inclusive; it will present exam- ples of particular techniques and some of the music that has been produced with them. 2. A BRIEF HISTORY OF ALGORITHMIC COMPOSITION Models of musical process are arguably natural to human musical activity. Listening involves both enjoyment of the sensual sonic experience and the setting up of expectations and possibilities of what is to come: “Retention in short- term memory permits the experience of coherent musical entities, comparison with other events in the musical flow, conscious or subconscious comparison with previous musical experience stored in long-term memory, and the continuous formation of expectations of coming musical events.” [7, 42] This second, active part of musical listening is what gives rise to the possibility, the development of musical form: “Be- cause we spontaneously compare any new feature appearing in consciousness with the features already experienced, and from this comparison draw conclusions about coming fea- tures, we pass through the musical edifice as if its construc- tion were present in its totality. The interaction of associa- tion, abstraction, memory and prediction is the prerequisite for the formation of the web of relations that renders the speed—everything’s composed—but not written yet—” (let- ter to his father, 30th December 1780). Mozart appar- ently distinguished between composing (at the keyboard, in sketches) and writing (i.e. preparing the full and final score), hence the confusion about the length of time taken to write certain pieces of music. 3 For example, in the realm of pitch: transposition, inversion, retrogradation, intervallic expansion or compression; with rhythm: augmentation, diminution, and addition.

Upload: phunganh

Post on 17-May-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algorithmic Composition: Computational Thinking in …people.ace.ed.ac.uk/staff/medward2/algorithmic-composition.pdf · in the second half of the twentieth century. ... Mozart is

Algorithmic Composition:Computational Thinking in Music

DRAFT

Michael EdwardsReader in Music Technology

School of Arts, Culture and EnvironmentUniversity of Edinburgh

Edinburgh, UKhttp://[email protected]

ABSTRACTDespite the still-prevalent but essentially nineteenth centuryperception of the Western creative artist, an algorithmic ap-proach to music composition has been in evidence in Westernclassical music for at least one thousand years. The historyof algorithmic composition—from both before and after theinvention of the digital computer—will be presented alongwith specific techniques and musical examples from the dis-tant and recent past.

KeywordsAlgorithmic Composition, Computer-aided Composition, Au-tomatic Composition, Computer Music, Stochastic Music,Xenakis, Ligeti, Lejaren Hiller.

1. INTRODUCTIONIn the West, the layman’s vision of the creative artist is

largely bound in romantic notions of inspiration sacred orsecular in origin. Images are plentiful; for example, a manstanding tall on a cliff top, the wind blowing through his longhair (naturally), waiting for that particular iconoclastic ideato arrive through the ether.1 Tales, some even true, of geniipenning whole operas in a matter of days, further blur thereality of the usually slowly-wrought process of composition.Mozart, with his speed of writing, is a famous example whoto some extent fits the cliche, though perhaps not quite aswell as legend would have it.2

1I’m thinking in particular of Caspar David Friedrich’spainting From the Summit, in the Hamburg Kunsthalle.2Mozart’s compositional process is a complex and oftenmisunderstood matter, complicated by myth—especially re-garding his now refuted ability to compose everything inhis head [12, 104]—and Mozart’s own statements such as“I must finish now, because I’ve got to write at breakneck

Permission to make digital or hard copies of all or part of this work forpersonal or classroom use is granted without fee provided that copies arenot made or distributed for profit or commercial advantage and that copiesbear this notice and the full citation on the first page. To copy otherwise, torepublish, to post on servers or to redistribute to lists, requires prior specificpermission and/or a fee.Copyright 200X ACM X-XXXXX-XX-X/XX/XX ...$10.00.

That composition should include calculation3 and, fromthe perspective of the non-specialist, seemingly arbitrary,uninspired technique or formal development, can lead to dis-appointment on the part of those casually interested in thesubject. What we shall see is that calculation has been partof the Western composition tradition for at least a thousandyears. This paper will outline the history of algorithmiccomposition from the pre- and post-digital computer age,concentrating in particular, but not exclusively, on how itdeveloped out of the avant-garde Western classical traditionin the second half of the twentieth century. This survey willbe more illustrative than all-inclusive; it will present exam-ples of particular techniques and some of the music that hasbeen produced with them.

2. A BRIEF HISTORY OF ALGORITHMICCOMPOSITION

Models of musical process are arguably natural to humanmusical activity. Listening involves both enjoyment of thesensual sonic experience and the setting up of expectationsand possibilities of what is to come: “Retention in short-term memory permits the experience of coherent musicalentities, comparison with other events in the musical flow,conscious or subconscious comparison with previous musicalexperience stored in long-term memory, and the continuousformation of expectations of coming musical events.” [7, 42]

This second, active part of musical listening is what givesrise to the possibility, the development of musical form: “Be-cause we spontaneously compare any new feature appearingin consciousness with the features already experienced, andfrom this comparison draw conclusions about coming fea-tures, we pass through the musical edifice as if its construc-tion were present in its totality. The interaction of associa-tion, abstraction, memory and prediction is the prerequisitefor the formation of the web of relations that renders the

speed—everything’s composed—but not written yet—” (let-ter to his father, 30th December 1780). Mozart appar-ently distinguished between composing (at the keyboard, insketches) and writing (i.e. preparing the full and final score),hence the confusion about the length of time taken to writecertain pieces of music.3For example, in the realm of pitch: transposition, inversion,retrogradation, intervallic expansion or compression; withrhythm: augmentation, diminution, and addition.

Page 2: Algorithmic Composition: Computational Thinking in …people.ace.ed.ac.uk/staff/medward2/algorithmic-composition.pdf · in the second half of the twentieth century. ... Mozart is

conception of musical form possible.” [29]For centuries, composers have taken advantage of this

property of music cognition to formalise compositional struc-ture. We cannot of course conflate formal planning with al-gorithmic techniques, but that the former should lead to thelatter was, as this paper shall argue, a historical inevitabil-ity.

Around 1026 Guido d’Arezzo (the inventor of modern staffnotation) developed a formal technique to set a text to mu-sic. A pitch was assigned to each vowel so that the melodyvaried according to the vowels in the text [20]. The 14th and15th centuries saw the development of the quasi-algorithmicisorhythmic technique, where rhythmic cycles (talea) are re-peated, often with melodic cycles (color) of similar or dif-fering lengths (potentially, though not generally in practice,leading to very long forms before the beginning of a rhyth-mic and melodic repeat coincide). Across ages and cultures,repetition, and therefore memory—of short motifs, longerthemes, or whole sections—is central to the development ofmusical form. In the Western context this is seen in variousforms: the classical rondo (with section structures such asABACA); the baroque fugue; and the classical sonata form,with its return not just of themes but tonality too.

Compositions based on number ratios are also found through-out musical history; for example, Dufay’s (1400–74) isorhyth-mic motet Nuper Rosarum Flores, written for the consecra-tion of Florence Cathedral on March 25th, 1436. The tem-poral structure of the motet is based on the ratios 6:4:2:3,these being the proportions of the nave, the crossing, theapse, and the height of the arch of the cathedral. A subjectof much debate is how far the use of proportional systemswas conscious on the part of various composers, especiallywith regards to Fibonacci numbers and the Golden Section.4

Evidence of Fibonacci relationships have been found, for in-stance, in the music of Bartok [26], Debussy [16], Schubert[17], and Bach [31], as well as various works of the 20thcentury [23].

Mozart is thought to have used algorithmic techniques ex-plicitly at least once. His Musikalisches Wurfelspiel (“Musi-cal Dice”)5 uses musical fragments which are to be combinedrandomly, according to dice throws (see figure 1). Such for-malisation procedures have not been limited to religious orart music. The Quadrille Melodist, sold by Professor Clin-ton of the Royal Conservatory of Music, London, in 1865,was marketed as a set of cards which allowed a pianist togenerate quadrille music (similar to a square dance). Appar-ently 428 million quadrilles could be made with the system[33, 823].

Right at the outset of the computer age, algorithmic com-position moved straight into the popular, kit-builder’s do-main. The Geniac Electric Brain of 1956 allowed customersto build a computer with which they could generate au-tomatic tunes (see figure 2) [35]. Such systems find theirmodern counterpart in the automatic musical accompani-ment software Band-in-a-Box.

4Fibonacci was the Italian mathematician (c.1170–c.1250)after whom the famous number series is named. This is asimple progression where successive numbers are the sum ofthe previous two: 0, 1, 1, 2, 3, 5, 8, 13, 21.... As we ascendthe sequence, the ratio of two adjacent numbers becomescloser to the so-called Golden Ratio (approx. 1:1.618).5Attributed to Mozart though not officially authenticatedor in the Kochel Catalogue of his works.

Figure 1: Mozart’s Musikalisches Wurfelspiel (“Mu-sical Dice”). Numbers over columns refer to eightparts of a waltz; numbers to the left of rows indicatepossible values of two thrown dice; numbers in thematrix refer to bar numbers of four pages of musicalfragments which are accordingly combined to createthe algorithmic waltz.

Figure 2: Part of an advertisement from 1958 forThe Geniac Brain, a DIY music computer kit.

Page 3: Algorithmic Composition: Computational Thinking in …people.ace.ed.ac.uk/staff/medward2/algorithmic-composition.pdf · in the second half of the twentieth century. ... Mozart is

2.1 The Avant GardeAfter World War II, many Western classical music com-

posers continued to develop the serial6 technique inventedby Arnold Schonberg (1874–1951) et al. Though generallyseen as a radical break with tradition, in light of the earlierhistorical examples we have just considered, serialism’s de-tailed organisation can be viewed as merely a continuationof the tradition of formalising musical composition. Indeed,one of the new generation’s criticisms of Schonberg was thathe had only radicalised pitch structure, leaving other param-eters, such as rhythm, dynamic, even form, in the nineteenthcentury [4]. They looked to the music of Schonberg’s pupilWebern for inspiration in organising these other parametersaccording to serial principles. Hence the rise of the total seri-alists: Boulez, Stockhausen, Pousseur, Nono et al in Europe;Milton Babbitt and his students at Princeton.7

Several composers, notably Xenakis (1922–2001) and Ligeti(1923–2006), offered criticisms and alternatives to serialismbut, significantly, their music was also often governed bycomplex, even algorithmic, procedures.8 The complexityof new composition systems made their implementation incomputer programmes ever more attractive. Furthermore,the development of software algorithms in other disciplinesmade cross-fertilization rife. Thus some techniques are in-spired by systems outside the realm of music, e.g. ChaosTheory (Ligeti, Desordre), Neural Networks (Gerhard E.Winkler, Hybrid II “Networks”) [38], and Brownian Motion(Xenakis, Eonta).

3. COMPUTER-BASED ALGORITHMICCOMPOSITION

Lejaren Hiller (1924–1994) is widely recognised as thefirst person to have applied computer programmes to algo-rithmic composition. The use of specially-designed, uniquecomputer hardware was common at US universities in themid-twentieth century. Hiller used the Illiac computer ofthe University of Illinois, Urbana-Champaign, to create ex-perimental new music with algorithms. His collaborationwith Leonard Isaacson resulted in 1956 in the first knowncomputer-aided composition, The Illiac Suite for String Quar-tet, programmed in binary and using, amongst other tech-niques, Markov Chains9 in ‘random walk’ pitch-generation

6Serialism is an organisational system in which pitches (firstof all) are organised into so-called twelve-tone rows, whereeach pitch in a musical octave is present and, ideally, equallydistributed throughout the piece. This was developed mostfamously by Arnold Schonberg in the early 1920s as a re-sponse to the difficulty of structuring atonal music i.e. musicwhich has no tonal centre or key (e.g. C major).7At this point we begin to distinguish between pieces whichonly organise pitch according to the series (dodecaphony)from those which extend organisation into music’s other pa-rameters (now strictly speaking, serialism, otherwise knownas integral or total serialism).8For further discussion and a very approachable introduc-tion to the musical thought of Ligeti and Xenakis, see chap-ter 2 of The Musical Timespace [7], in particular pages 36–39.9Familiar no doubt to most readers and first presented in1906, Markov chains are named after the Russian mathe-matician Andrey Markov (1856-1922) whose research intorandom processes led to his eponymous theory. They areamongst the most popular algorithmic composition tools.Being stochastic processes, where future states are depen-

algorithms [37, 2]. Famous for his own random-process in-fluenced compositions if not his work with computers, com-poser John Cage recognised the potential of Hiller’s systemsearlier than most. The two collaborated on HPSCHD, apiece for “7 harpsichords playing randomly-processed mu-sic by Mozart and other composers, 51 tapes of computer-generated sounds, approximately 5,000 slides of abstract de-signs and space exploration, and several films”[13]. This waspremiered at the University of Illinois at Urbana-Champaignin 1969. Summarising perspicaciously an essential differ-ence between traditional and computer-assisted composi-tion, Cage said in an interview conducted during the compo-sition of HPSCHD that “formerly, when one worked alone,at a given point a decision was made, and one went in one di-rection rather than another; whereas, in the case of workingwith another person and with computer facilities, the needto work as though decisions were scarce—as though you hadto limit yourself to one idea—is no longer pressing. It’s achange from the influences of scarcity or economy to the in-fluences of abundance and—I’d be willing to say—waste.”[25, 21].

3.1 Stochastic versus Deterministic proceduresA basic historical division in the world of algorithmic com-

position is between indeterminate and determinate mod-els, i.e. those that use stochastic/random procedures (e.g.Markov chains) and those whose results are fixed by the al-gorithms and remain unchanged no matter how often thealgorithms are run. Examples of the latter are cellular au-tomata (though these can be deterministic or stochastic [33,860-865]); Lindenmayer Systems (see section 3.4 for moreon the deterministic vs. stochastic debate in this context);Charles Ames’ constrained search algorithms for selectingmaterial properties against a series of constraints[1]; andthe compositions of David Cope which use his Experimentsin Musical Intelligence system [8]. The latter is based on theconcept of recombinacy, where new music is created from al-ready existing works; it thus allows the recreation of musicin the style of various classical composers, to the shock anddelight of many.

3.2 XenakisKnown primarily for his instrumental compositions but

also an engineer and architect, Iannis Xenakis was a pioneerof algorithmic composition and computer music. Using lan-guage typical for the sci-fi age he wrote: “With the aid ofelectronic computers, the composer becomes a sort of pilot:he presses buttons, introduces coordinates, and supervisesthe controls of a cosmic vessel sailing in the space of sound,across sonic constellations and galaxies that he could for-merly glimpse only in a distant dream.” [39, 144]

Xenakis’s approach, which led to the Stochastic MusicProgramme (henceforth SMP) and radically new pieces suchas Pithoprakta (1956), used formulae originally developed byscientists to explain the behaviour of gas particles (Maxwelland Boltzmann’s kinetic theory of gases) [30, 92]. He sawhis stochastic compositions as clouds of sound, individualnotes10 being the analogue of gas particles. The choiceand distribution of notes was decided by procedures that

dent on current and perhaps past states, they are perfectfor e.g. pitch selection.

10Notes being the combination of pitch and duration as op-posed to simply pitch.

Page 4: Algorithmic Composition: Computational Thinking in …people.ace.ed.ac.uk/staff/medward2/algorithmic-composition.pdf · in the second half of the twentieth century. ... Mozart is

involved random choice, probability tables that weigh theoccurrence of specific events against those of others. Xe-nakis created several works with SMP, often more than onework with the output of a single computer batch process11

(most probably because of limited access to the IBM 7090he used for this work). Eonta (1963–4), for two trumpets,three tenor trombones, and piano, was composed with SMP.The programme was applied in particular to the creation ofthe massively complex opening piano solo.

Like another algorithmic composition/computer music pi-oneer Gottfried Michael Koenig (1926–), Xenakis had nocompunction in adapting the output of his algorithms ashe saw fit. Regarding Atrees (1962), Matossian claims Xe-nakis used “75% computer material, composing the remain-der himself.” [30, 161]. At least in his Projekt 1 (1964)12

Koenig saw transcription (i.e. from computer output to mu-sical score) as an important part of the process of algorithmiccomposition: “Neither the histograms nor the connection al-gorithm contains any hints about the envisaged, ‘unfolded’score, which consists of instructions for dividing the laborof the production changes mode, that is, the division intoperformance parts. The histogram, unfolded to reveal theindividual time and parameter values, has to be split up intovoices” [22, 30].

Hiller, on the other hand, believed that if the output ofthe algorithm is deemed insufficient, then the programmeshould be modified and the output regenerated [33, 845].Of course, several programmes which facilitate algorithmiccomposition include direct connection to their own or third-party computer sound generation.13 This obviates the needfor transcription and even hinders this arguably fruitful in-tervention. Furthermore, such systems allow the traditionalor even conceptual score to become redundant. Thus al-gorithmic composition techniques allow a fluid and unifiedrelationship between macrostructural musical form and mi-crostructural sound synthesis/processing, as evidenced againby Xenakis in his Dynamic Stochastic Synthesis programmeGendy3 (1992) [39, 289].

3.3 More current examplesContemporary techniques tend to be hybrids of determin-

istic and stochastic approaches. Systems which use tech-niques from the area of Artificial Intelligence (AI) and/orLinguistics are the generative-grammar14 based system BolProcessor (Bel and Kippen), and expert systems such as Ke-mal Ebcioglu’s CHORAL. Other statistical approaches thatuse, for instance, Hidden Markov Models (e.g. [18]), tend toneed a significant amount of data to train the system; theytherefore rely on and generate pastiche copies of the music ofa particular composer (which must be codified in machine-readable form) or historical style. Whilst naturally of greatsignificance to researchers in the field of AI, Linguistics,

11“With a single 45-minute programme on the IBM 7090, hesucceeded in producing not only eight compositions whichstand up as integral works but also in leading the develop-ment of computer-aided composition” [30, 161].

12Written to test the rules of serial music but involving ran-dom decisions [21].

13Especially modern examples such as Common Music, PureData, and SuperCollider.

14Such systems are generally inspired by Chomsky’s gram-mar models [6] and Lerdahl and Jackendorff’s applicationsof such approaches to generative music theory [27].

Computer Science, etc., in the author’s opinion such systemstend to be of limited use to composers who write music ina modern and personal style (which perhaps resists codifi-cation because of its notational and sonic complexity, and,more simply, its lack of sufficient and stylistically consistentdata: the so-called sparse data problem). But this is also tosome extent indicative of the general difficulty of modelinglanguage and human cognition: the software codification ofthe workings of a spoken language that is understood bymany and reasonably standardised is one thing; the codifi-cation of the quickly developing and widely divergent field ofcontemporary music is another matter altogether. Thus wecan witness a division in the field between composers whoare concerned with creating new music with personalisedsystems, and researchers interested in machine learning, AIetc. The latter may quite understandably find it more use-ful to generate music in well-known styles not only becausethere is extant data but also because familiarity of materialwill simplify some aspects of the assessment of results. Nat-urally though, more collaboration between composers andresearchers could lead to very fruitful results.

3.3.1 Outside academiaThe application of algorithmic composition techniques has

not been restricted to academia or the classical avant garde.Pop/ambient musician Brian Eno (1948–) is known for hisadmiration and use of generative systems in pieces such asMusic for Airports (1978). Eno was inspired by the Amer-ican minimalists, in particular Steve Reich (1936–) and histape piece It’s gonna rain (1965). This is not computer mu-sic but it is process music, whereby a system is devised—usually repetitive in the case of the minimalists—and al-lowed to run, generating music in the form of notation orelectronic sound. About his Discreet Music (1975), Enosaid: “Since I have always preferred making plans to execut-ing them, I have gravitated towards situations and systemsthat, once set into operation, could create music with littleor no intervention on my part. That is to say, I tend towardsthe roles of planner and programmer, and then become anaudience to the results” [15, 252].

3.3.2 Improvisation systemsAlgorithmic composition techniques are, then, clearly not

limited to music of a certain aesthetic or stylistic persua-sion. Neither are they limited to a completely fixed viewof composition where all the pitches, rhythms, etc., are setdown in advance. George Lewis’s Voyager is a work for hu-man improvisors and “computer-driven, interactive ‘virtualimprovising orchestra”’ [28, 33]. Its roots are, according toLewis, in the African-American tradition of multidominance,described by him (and borrowing from Jeff Donaldson) as in-volving multiple simultaneous structural streams, these be-ing in the case of Voyager at “both the logical structureof the software and its performance articulation” [28, 34].Lewis programmed Voyager in the Forth language popularwith computer musicians in the 1980s. The related improvi-sation system OMAX, from IRCAM, is available within thenow more widely used computer music systems MaxMSPand OpenMusic. OMAX uses Artificial Intelligence basedMachine Learning techniques to parse incoming musical datafrom a human musician, then the results of the analysisto generate new material in an improvisatory context[3, 2].Though in Voyager the computer is also used to analyse

Page 5: Algorithmic Composition: Computational Thinking in …people.ace.ed.ac.uk/staff/medward2/algorithmic-composition.pdf · in the second half of the twentieth century. ... Mozart is

and respond to the human improvisors’ input, this is not es-sential for the programme to generate music (via MIDI15).As Lewis writes, “I conceive a performance of Voyager asmultiple parallel streams of music generation, emanatingfrom both the computers and the humans—a nonhierar-chical, improvisational, subject-subject model of discourse,rather than a stimulus/ response setup” [28, 36].

3.3.3 slippery chickenIn my own case, work on the specialised algorithmic com-

position programme slippery chicken [10] has been ongo-ing since 1999. Written in Common Lisp and its object-oriented extension CLOS, it is mainly deterministic but alsohas stochastic elements. It has been used to create musi-cal structure for pieces since its inception and is now at thestage where it can generate, in one pass, complete musicalscores for traditional instruments, or with the same datawrite sound files using samples16 or MIDI file realisations ofthe instrumental score.17 The project’s main aim is to facil-itate a melding of electronic and instrumental sound worlds,not just at the sonic but at the structural level. Hence cer-tain processes common in one medium (for instance audioslicing and looping) are transferred to another (the slicing upof notated musical phrases and the instigation of sub-phraseloops, for example). Techniques for innovative combinationof rhythmic and pitch data—in my opinion one of the mostdifficult aspects of making convincing musical algorithms—are also offered [10].

3.4 Lindenmayer SystemsLike writing a paper, composing music—perhaps espe-

cially with computer-based algorithms—is most often an it-erative process. Material is first set down in raw form, onlyto be edited, developed, and reworked over several passesbefore the final refined form is achieved. Stochastic proce-dures, if they are not simply to be used to generate materialthat is to be reworked by hand or in some other fashion,presents therefore particular problems to the composer. Ifan alteration of the algorithm is deemed necessary, no mat-ter how small, then re-running the procedure is essential.But this will generate a different set of randomly-controlledresults, these perhaps now lacking some of the characteris-tics the composer deemed musically significant after the firstpass.18

15MIDI (Musical Instrument Digital Interface): the standardmusic industry protocol for interconnecting electronic in-struments and related devices.

16Samples are usually short digital sound files of individualor an arbitrary number of notes/sonic events.

17To accomplish this the software interfaces with parts ofthe open-source software systems Common Music, CommonLisp Music, and Common Music Notation (all freely avail-able from http://ccrma-stanford.edu/software).

18This is, though, a simplistic description of the matter.Most stochastic procedures involve the encapsulation of var-ious tendencies over large data sets, the random details ofwhich are insignificant when compared with the structureof the whole. Still, some details may take on more musicalimportance than was intended, and to lose these may detri-mentally affect the composition. Of course, the composercould avoid such problems by using a random number gen-erator with a fixed and stored seed, guaranteeing that thepseudo-random numbers are generated in the same ordereach time the process is restarted. Better still would be tomodify the algorithm to take these salient though originally

But deterministic procedures may be more apposite. Forinstance, Lindenmayer Systems19 (henceforth L-Systems) whosesimplicity, elegance, yet resulting self-similarity make themideal for composition. Take a very simple example, where aset of rules is defined. These associate a key with a resultof two further keys which then in turn form indices for anarbitrary number of iterations of key substitution (see figure3).

1 → 2 32 → 1 33 → 2 1

Figure 3: Simple L-System rules.

Given a starting seed for the lookup and substitution pro-cedure (or rewriting, as it is more generally known), an in-finite number of results can be generated (see figure 4).

Seed: 21 3

2 3 | 2 11 3 | 2 1 | 1 3 | 2 3

2 3 | 2 1 | 1 3 | 2 3 | 2 3 | 2 1 | 1 3 | 2 1

Figure 4: Step-by-step generation of results fromsimple L-System rules and a seed.

Self-similarity becomes clear when large result sets areproduced (see figure 5 and note the repetitions of sequencessuch as 2 1 1 3 or 2 3 2 3).

2 3 2 1 1 3 2 3 2 3 2 1 1 3 2 1 1 3 2 1 1 3 2 3 2 3 2

1 1 3 2 3 2 3 2 1 1 3 2 3 2 3 2 1 1 3 2 1 1 3 2 1 1 3

2 3 2 3 2 1 1 3 2 1 1 3 2 1 1 3 2 3 2 3 2 1 1 3 2 1 1

3 2 1 1 3 2 3 2 3 2 1 1 3 2 3 2 3 2 1 1 3 2 3 2 3 2 1

Figure 5: Larger result set from simple L-Systemrules.

These numbers can of course be applied to any musical pa-rameter or material (pitch, rhythm, dynamic, phrase, har-mony, etc.) Seen musically, the results of such simple L-Systems tend towards stasis in that only results that are partof the original rules are returned and all results are presentthroughout the returned sequence. The result is, though, de-pendent on the rules defined: subtle manipulations of morecomplex/numerous rules can result in musically interestingdevelopments. Composers have, for instance, used more fi-nessed L-Systems—where the result of a particular rule maybe dependent on a sub-rule perhaps—leading to more or-ganic, developing forms. Hanspeter Kyburz’s Cells for sax-ophone and ensemble is one such example. Martin Supperdescribes Kyburz’s use of L-Systems in [37, 52]: Results ofthirteen generations of L-System rewrites are used to selectpre-composed musical motifs. Like Hiller before him, Ky-burz uses algorithmic composition techniques to generateand select musical material for the preparation of instru-mental scores. The listener, however, will most probably be

unforeseen features into account.19Named after biologist Aristid Lindenmayer (1925–1989)who developed this system (or formal language, based ongrammars by Noam Chomsky [32, 3]) which is able to modelvarious natural growth processes, e.g. those of plants.

Page 6: Algorithmic Composition: Computational Thinking in …people.ace.ed.ac.uk/staff/medward2/algorithmic-composition.pdf · in the second half of the twentieth century. ... Mozart is

unaware of the application of software in the composition ofsuch music.

3.4.1 Transitioning L-Systems: TramontanaAs I tend to write music that is concerned with develop-

ment and transition, my use of L-Systems is somewhat moreconvoluted. Tramontana, for viola and computer [11] usesL-Systems in the last section. Unlike normal L-Systems how-ever, I employ transitioning or interpolating L-Systems, aninvention of my own whereby the numbers returned by theL-System are used as lookup indices into a table whose resultdepends on transitions between related but developing ma-terial types. The transitions themselves use Fibonacci-based‘folding-in’ structures where the new material is interspersedgradually until it becomes dominant. For example, a tran-sition from material 0 to material 1 may look like figure 6.

0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 00 1 0 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 0 1 1 0 1 1 1 1 0 1 11 1 1 1 1 1

Figure 6: Fibonacci-based transition from material0 to material 1. Note that the first appearance of 1is at position thirteen, the next being eight positionsafter this, the next again five positions later, etc., allthese numbers being so-called Fibonacci numbers.

In the case of the last section of Tramontana, there is aslow development from fast, repeated chords towards moreand more flageolets20 on the C and G strings. Normalpitches and half flageolets21 then begin to dominate, witha tendency towards more and more of the former. At thispoint, flageolets on the D string are also introduced. Allthese developments are created with transitioning L-Systems.The score, a short extract of which is presented in figure 7,was generated with Bill Schottstaedt’s Common Music No-tation software, taking advantage of its ability to includealgorithmically-placed non-standard note heads and othermusical signs. It is perhaps worth noting that even beforeI began work with computers, I was already composing insuch a manner. Now, with slippery chicken algorithms, it ispossible to programme these structures, generate the music,test, re-work, and re-generate, etc., etc. A particular advan-tage of working with the computer here is that it is a simplematter to extend or shorten sections, something that wouldbe so time-consuming with pencil and paper as to becomeprohibitive.

Figure 7: Extract beginning bar 293 of the author’sTramontana for viola and computer.

20Familiar to guitarists, flageolets, or harmonics, are specialpitches achieved by touching the string lightly with a left-hand finger at a nodal point in order to bring out higherfrequencies which are related to the fundamental of the openstring by integer multiples.

21Half flageolets are achieved by pressing the string similarlyas with a full flageolet but not at a nodal point; the resultis a darker, dead-sounding pitch.

4. MUSICAL EXAMPLE: LIGETI’SDÉSORDRE

Gyorgy Ligeti (1923-2006) is known to the general pub-lic mainly through the use of his music in several StanleyKubrick films: 2001: A Space Odyssey uses Lux Aeternaand Requiem (without Ligeti’s permission and subjected toa protracted but failed lawsuit); The Shining uses Lontano;and Eyes Wide Shut uses Musica Ricercata.

In the late 1950s, after leaving his native Hungary, Ligetiworked in the same studios as Cologne electronic music pio-neers Karlheinz Stockhausen and Gottfried Michael Koenig.Nevertheless, he produced very little electronic music of hisown. His interest in science and mathematics, however, ledto several instrumental pieces influenced by, for example,fractal geometry or chaos theory. But these influences didnot lead to a computer-based algorithmic approach: “Some-where underneath, very deeply, there’s a common place inour spirit where the beauty of mathematics and the beautyof music meet. But they don’t meet on the level of algo-rithms or making music by calculation. It’s much lower,much deeper—or much higher, you could say.” (Ligeti, quotedin [36, 14]).

Nevertheless, as a further example allow a presentationof the structure of Gyorgy Ligeti’s Desordre from his firstbook of Piano Etudes. This is a particularly fine examplefor several reasons:

1. The structures of Desordre are deceptively simple inconcept yet beautifully elegant in effect. The clearlydeterministic algorithmic thinking lends itself quite nat-urally to a software implementation.

2. Ligeti is a major composer admired by experts andnon-experts alike. He is generally not associated withalgorithmic composition however.22 Indeed, Desordrewas almost certainly composed by hand with a penciland paper, as opposed to at a computer. As such, De-sordre illustrates the clear link in the history of compo-sition to algorithmic/computational thinking, bringingalgorithmic composition back into mainstream musicalfocus.

3. I have implemented algorithmic models of the first partof Desordre in the open-source software system PureData (PD). This software, and the discussion presentedbelow, is based on analyses by Tobias Kunze [24] (usedhere with permission) and Hartmut Kinzler [19]. It isfreely downloadable [9]; tinkering with the initial datastates is instructive and fun.

4.1 Désordre’s algorithmsThe main argument of Desordre consists of foreground and

background textures:

• Foreground (accented, loud): two simultaneous instancesof the same basic process (melodic/rhythmic: see be-low for details), one in each hand, both doubled at theoctave, and using white note (right hand) and blacknote23 (pentatonic, left hand) modes.

22Ligeti’s son, Lukas, has confirmed to the author that hisfather was interested conceptually in computers, read a lotabout them over the years, but never worked with them inpractice.

23White and black here refer to the colour of the keys on themodern piano.

Page 7: Algorithmic Composition: Computational Thinking in …people.ace.ed.ac.uk/staff/medward2/algorithmic-composition.pdf · in the second half of the twentieth century. ... Mozart is

• Background (quiet): continuous, generally rising qua-ver (eighth note) pulse notes, centred between the fore-ground octaves, one in each hand, in the same modeas the foreground hand.

In the first part of the piece the basic foreground processconsists of a melodic pattern cycle consisting of the scale-step shape given in figure 8. This is stated on successivelyhigher (right hand, 14 times, 1 diatonic step transposition)and lower (left hand, 11 times, 2 diatonic steps transposi-tion) degrees. Thus a global, long-term movement is createdfrom the middle of the piano outwards, to the high and lowextremes.

Right hand (white notes), 26 notes, 14 barsPhrase a: 0 0 1 0 2 1 -1Phrase a’: -1 -1 2 1 3 2 -2Phrase b: 2 2 4 3 5 4 -1 0 3 2 6 5

Left hand (black notes), 33 notes, 18 barsPhrase a: 0 0 1 0 2 2 0Phrase a’: 1 1 2 1 -2 -2 -1Phrase b: 1 1 2 2 0 -1 -4 -3 0 -1 3 2 1 -1 0 -3 -2 -3 -5

Figure 8: Foreground melodic pattern (scale steps)of Desordre [24].

The foreground rhythmic process consists of slower-moving,irregular combinations of quaver-multiples that tend to re-duce in duration over the melodic cycle repeats to create anacceleration towards continuous quaver pulses (see figure 9).

right hand:

cycle 1: a: 3 5 3 5 5 3 7

a’: 3 5 3 5 5 3 7

b: 3 5 3 5 5 3 3 4 5 3 3 5

cycle 2: 3 5 3 4 5 3 8

3 5 3 4 5 3 8

3 5 3 4 5 3 3 5 5 3 3 4

cycle 3: 3 5 3 5 5 3 7

3 5 3 5 5 3 7

3 5 3 5 5 3 3 4 5 3 3 5

cycle 4: 3 5 3 4 5 2 7

2 4 2 4 4 2 5

2 3 2 3 3 1 1 3 3 1 1 3

cycle 5: 1 2 1 2 2 1 3

1 2 1 2 2 1 3

1 2 1 2 2 1 1 2 2 1 1 2

...

left hand:

3 5 3 5 5 3 8

3 5 3 5 5 3 8

3 5 3 5 5 3 3 5 5 3 3 5 3 5 3 5 5 3 8

3 5 3 5 5 3 8

3 5 3 5 5 3 8

3 5 3 5 5 3 3 5 5 3 3 5 3 5 3 5 5 3 8

3 5 3 5 5 3 8

3 5 3 5 5 2 7

3 4 3 4 4 2 2 4 4 2 2 3 2 3 1 3 3 1 4

1 3 1 2 2 1 3

1 2 1 2 2 1 3

1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 3

1 3 1 2 2 1 3

1 2 1 2 2 1 3

1 2 1 2 2 1 1 2 2 1 1 2 1 2 1 2 2 1 2

...

Figure 9: Foreground rhythmic pattern (quaver du-rations) of Desordre [24].

The similarity between the two hands’ foreground rhyth-mic structure is obvious but the duration of seven quaversin the right hand at the end of cycle 1a, as opposed to eightin the left, makes for the clearly audible decoupling of thetwo parts. This is the beginning of the process of ‘disorder’,or chaos, and is reflected in the unsynchronised bar lines ofthe score starting at this point (see figure 10).

Figure 10: Desordre: first system of score

To summarise then, in Desordre we have a clear, com-pelling, yet not entirely predictable musical development ofrhythmic acceleration coupled with a movement from the

middle piano register to the extremes of high and low, allexpressed through two related and repeating melodic cycleswhose slightly differing lengths result in a combination thatdislocates and leads to metrical disorder. I invite the readerto investigate this in more detail by downloading my soft-ware implementation available at [9].

5. CONCLUSION: RESISTANCE TO ALGO-RITHMIC COMPOSITION

There has been considerable resistance to algorithmic com-position from all sides, from musicians to the general public.This resistance bears comparison to the reception of the sup-posedly overly-mathematical serial approach established bythe composers of the Second Viennese School. Alongside thetechniques of other music composed from the beginning ofthe twentieth century onwards, the serial principle itself isfrequently considered to be the reason why the music—so-called modern music, but now actually close to a hundredyears old—may not appeal. I propose that a more enlight-ened approach to the arts in general, especially those thatpresent a challenge, would be a more inward-looking exam-ination of the individual response, a deferral of judgmentand acknowledgment that, first and foremost, a lack of fa-miliarity with the style and content may lead to a neutralor negative response. Only after further investigation andfamiliarisation can deficiencies in the work be considered.24

Algorithmic composition is often viewed as a sideline incontemporary musical activity, as opposed to a logical ap-plication and incorporation of compositional technique intothe digital domain. Without wishing to imply that instru-mental composition is in a general state of stagnation, if thecomputer is the universal tool—there is surely no doubt—then not to apply it to composition would be, if not exactlyan example of Ludditism, then at least to risk missing im-portant aesthetic developments that only the computer canstimulate and facilitate and which other artistic fields arealready taking advantage of. That algorithmic thinking hasbeen present in Western composition for at least a thousandyears has been established. That such thinking should lenditself to formalisation in computer algorithms was inevitable.

But Hiller’s work and his 1959 article for the ScientificAmerican [14] led to much controversy and press attention.Hostility to his achievements25 was such that the Grove Dic-tionary of Music and Musicians26 did not include an articleon it until shortly before his death. This hostility arose nodoubt more from a basic misunderstanding of compositionalpractice than from anything intrinsic to Hiller’s work.

Much of the resistance to algorithmic composition that

24To paraphrase Ludger Brummer, from information theorywe know that new information is perceived as chaotic or in-teresting but not expressive. New information needs to bestructured before it can be understood, and in the case ofaesthetic experience, this structuring process involves com-parison to an ideal, i.e. an established notion of beauty [5,36].

25Speaking of the reaction to The Illiac Suite, Hiller said“There was a great [deal] of hostility, certainly in the musicalworld... I was immediately pigeonholed as an ex-chemistwho had bungled into writing music and probably wouldn’tknow how to resolve a dominant seventh chord.” (Interviewwith Vincent Plush, 1983, from [2, 12].)

26The Grove is the English-speaking world’s most widely-used and arguably authoritative musicological resource.

Page 8: Algorithmic Composition: Computational Thinking in …people.ace.ed.ac.uk/staff/medward2/algorithmic-composition.pdf · in the second half of the twentieth century. ... Mozart is

persists to this day stems from a basic misunderstandingthat the computers compose the music, not the composer.This is, in the vast majority of cases where the composeris also the programmer, simply not true. As Curtis Roadspoints out, it takes a good composer to design algorithmsthat will result in music that captures the imagination [33,852].

Furthermore, using algorithmic composition techniquesdoes not by necessity imply less composition work or a short-cut to musical results; rather, it is a change of focus fromnote-to-note composition to a top-down formalisation of com-positional process. Composition is in fact often slowed downby the requirement to express musical ideas and encapsulatetheir characteristics in a highly structured and non-musicalgeneral programming language. Learning the discipline ofprogramming itself is an altogether time-consuming and, forsome composers, insurmountable problem.

Perhaps counter-intuitively though, the formalisation ofa personal composition technique allows the composer toproceed from concrete musical or abstract formal ideas intorealms hitherto unimagined—some, I would argue, impos-sible to achieve via any other means than with computersoftware. And as composer Helmut Lachenmann wrote, “acomposer who knows exactly what he wants, wants onlywhat he knows—and that is one way or another too little”[34, 24]. The computer can help composers overcome repeat-ing what they and we already know by aiding more thoroughinvestigations of material: once procedures are programmed,modifications and manipulations are simpler than with tra-ditional pen and paper. By “pressing buttons, introducingcoordinates, and supervising the controls,” to quote Xenakisagain [39, 144], the composer is able to stand back and de-velop compositional material en masse, applying proceduresand assessing, rejecting, accepting, or further processing re-sults of an often surprising nature. Algorithmic compositiontechniques clearly further individual musical and composi-tional development through computer-programming enabledvoyages of musical discovery.

6. REFERENCES[1] Charles Ames. Stylistic Automata in “Gradient”.

Computer Music Journal, 7(4):45–56, 1983.

[2] John Bewley. Lejaren A. Hiller: Computer MusicPioneer. Music Library Exhibit, University of Buffalo,2004. PDF available athttp://library.buffalo.edu/libraries/units/music/exhibits/hillerexhibitsummary.pdf (accessed August12th 2009).

[3] Assayag Bloch and Chemillier. Omax-Ofon. Soundand Music Computing (SMC), 2006.

[4] Pierre Boulez. Schoenberg est mort. Score, (6):18–22,February 1952.

[5] Ludger Brummer. Using a Digital Synthesis Languagein Composition. Computer Music Journal,18(4):35–46, 1994.

[6] Noam Chomsky. Syntactic Structures. Mouton, TheHague, 1957.

[7] Erik Christensen. The Musical Timespace, a Theory ofMusic Listening. Aalborg University Press, Aalborg,1996.

[8] David Cope. Experiments in Musical Intelligence. A-REditions, Madison, WI, 1996.

[9] Michael Edwards. A Pure Data implementation ofLigeti’s Desordre. Open-source music software.http://www.michael-edwards.org/software/desordre.zip.

[10] Michael Edwards. slippery chicken: a specialisedalgorithmic composition program. Unpublishedobject-oriented Common Lisp software. Seehttp://www.michael-edwards.org/slippery-chicken.

[11] Michael Edwards. Tramontana. Sheet music: sumtone,2004.http://www.sumtone.com/work.php?workid=101.

[12] Cliff Eisen and Simon P. Keefe, editors. TheCambridge Mozart Encyclopedia. CambridgeUniversity Press, Cambridge, 2006.

[13] The Electronic Music Foundation. HPSCHD.http://emfinstitute.emf.org/exhibits/hpschd.html(accessed 17th August 2009).

[14] Lejaren Hiller. Computer Music. Scientific American,201(6):109–120, December 1959.

[15] Thomas Holmes. Electronic and Experimental Music.Taylor & Francis Ltd, London, 2003.

[16] Roy Howat. Debussy in Proportion–a musical analysis.Cambridge University Press, Cambridge, 1983.

[17] Roy Howat. Architecture as drama in late Schubert.In Brian Newbould, editor, Schubert Studies, pages168 – 192. Ashgate Press, London, 1998.

[18] Anna Jordanous and Alan Smail. ArtificiallyIntelligent Accompaniment using Hidden MarkovModels to Model Musical Structure. In C. Tsougrasand R. Parncutt, editors, Proceedings of the fourthConference on Interdisciplinary Musicology (CIM08),2008.

[19] Hartmut Kinzler. Gyorgy ligeti: decision and

automatism in “Desordre”, 1er Etude, Premier Livre.Interface, Journal of New Music Research,20(2):89–124, 1991.

[20] H. Kirchmeyer. On the historical construction ofrationalistic music. Die Reihe, 8:11–29, 1962.

[21] Gottfried Michael Koenig. Project 1.http://home.planet.nl/ gkoenig/indexe.htm (accessed17th August 2009).

[22] Gottfried Michael Koenig. Aesthetic Integration ofComputer-Composer Scores. Computer Music Journal,7(4):27–32, 1983.

[23] J Kramer. The Fibonacci Series in Twentieth CenturyMusic. Journal of Music Theory, (17):111–148, 1973.

[24] Tobias Kunze. Desordre. Unpublished article availableathttp://www.fictive.com/t/pbl/1999 desordre/ligeti.html(accessed 5th August 2009).

[25] Lejaren Hiller, Larry Austin, John Cage. An Interviewwith John Cage and Lejaren Hiller. Computer MusicJournal, 16(4):15–29, 1992.

[26] Erno Lendvai. Bela Bartok: an analysis of his music.Kahn & Averill, London, 1971.

[27] Lerdahl and Jackendorff. A generative theory of tonalmusic. MIT Press, Cambridge, Mass., 1983.

[28] George Lewis. Too Many Notes: Computers,Complexity and Culture in Voyager. Leonardo MusicJournal, 10:33–39, 2000.

[29] Gyorgy Ligeti. Uber Form in der neuen Musik.

Page 9: Algorithmic Composition: Computational Thinking in …people.ace.ed.ac.uk/staff/medward2/algorithmic-composition.pdf · in the second half of the twentieth century. ... Mozart is

Darmstadter Beitrage zur neuen Musik, 10:23–35,1966.

[30] Nouritza Matossian. Xenakis. Kahn & Averill,London, 1986.

[31] Hugo Norden. Proportions in Music. FibonacciQuarterly, 2:219–222, 1964.

[32] Prusinkiewicz and Lindenmayer. The AlgorithmicBeauty of Plants. Springer-Verlag, New York, 1990.

[33] Curtis Roads. The Computer Music Tutorial. MITPress, Cambridge, Massachusetts, 1996.

[34] David Ryan and Helmut Lachenmann. Composer inInterview: Helmut Lachenmann. Tempo, (210):20–24,1999.

[35] J Sowa. A machine to compose music. Oliver GarfieldCo., New Haven, 1956. Instruction manual forGENIAC.

[36] Richard Steinitz. Music, Maths & Chaos. MusicalTimes, 137(1837):14–20, March 1996.

[37] Martin Supper. A Few Remarks on AlgorithmicComposition. Computer Music Journal, 25(1):48–53,2001.

[38] Gerhard E Winkler. Hybrid II: “Networks”. CDrecording, 2003. sumtone cd1: stryngebite. Seehttp://www.sumtone.com/recording.php?id=17(accessed 5th August 2009).

[39] Iannis Xenakis. Formalized Music. Pendragon,Hillsdale NY, 1992.