Page  00000001 A Pragmatic Approach to Set-Based Algorithmic Composition Steven L. Ricks and Morgan L. Quigley School of Music, Brigham Young University steve.ricks mquigley Abstract Musical passages that contain repetitive patterns, nested structures, or apparently random segments can often be elegantly described using a set-based algorithmic framework. We present a brief mathematical formalism and a hierarchal model that abstracts these compositional techniques. We then discuss our freely available software program that demonstrates many of these ideas. 1 Introduction Several common compositional techniques can be viewed as operations on mathematical sets containing musical elements. In particular, multisets are useful abstractions of collections of musical elements, as they permit multiple copies of the same element to be present in the set. Musical devices such as repeated sequences of rhythmic durations or pitches can be viewed as extractions from linearly ordered multisets. Simple forms of chance music involve choosing randomly from a pre-defined collection of pitches; this technique can be seen as extracting elements from an unordered multiset. Patterns of accented dynamics can also be seen as linearly ordered multisets of dynamic markings. A major portion of the composer's task in creating works featuring the previously discussed techniques consists of creating the sets of musical elements that function as the "source material" for the algorithmic process. An expansion rule of the composer's choosing is then applied to produce an output vector of musical elements, such as a sequence of pitch values or rhythmic durations. Using computer software to automate this process greatly accelerates the production of algorithmic musical passages, and allows the composer to experiment with a variety of source sets and expansion rules in a fraction of the time required for traditional (e.g. paper-and-pencil) methods. Once the output vector is generated, the composer is free to handedit the output and incorporate it into a traditional score. In this context, the computer is seen as an enabling device that allows composers to create more complex algorithmic structures than are practical using traditional methods. This form of computer-assisted composition could be classified as "score synthesis" to differentiate it from "sound synthesis" algorithms that directly produce digital audio (Supper 2001). We begin by describing our hierarchal model of set-based algorithmic compositions. We then describe the design and capabilities of our freely available software implementation of these ideas, after which we list potential areas of future work. Our hierarchal model and its software implementation are not meant to be encyclopedic in scope; rather, they represent a useful subset of common tasks of score synthesis presented in a pragmatic and approachable style. 2 Compositional Model 2.1 Overview As discussed in the previous section, composers of several common types of algorithmic music are, in effect, creating one or more sets of musical material. These sets may be seen as ordered sets of pitch classes, as used in twelve-tone serial music, or they may be ordered multisets of rhythms, as used in renaissance isorhythms or in any number of current or historical genres. The compositional process begins with the composer specifying the source set of musical elements. Then, algorithmic rules are applied to produce an expansion vector of musical elements from the source set. The composer then analyzes what has been produced and possibly makes changes to the source set and algorithmic rule, continually repeating the process until a satisfactory output vector is obtained. The process of expanding a source set into a final output vector can be expressed as E A(S), where E represents the generated vector of musical material, A represents the algorithmic operator, and S represents the source set. To produce a composite output vector of complete notes, rather than just a vector of a single musical element such as pitch or duration, it is necessary to produce an ordered output vector for each musical element, and combine them to produce an output vector containing ordered pairs of the desired elements. For purposes of this discussion, we limit the Proceedings ICMC 2004

Page  00000002 musical elements to pitches, rhythms, and dynamic levels: E = (Ap(Sp), A,(Sr), Ad (Sd)) where AP, Ar, Ad refer to the algorithmic rules used to generate the pitch, rhythmic, and dynamic vectors, and SP, Sr, and Sd refer to the respective source sets. The flexibility and power of this system comes from the fact that source sets can be nested inside each other, producing self-similarity and much higher degrees of complexity in the resultant output vector. The mechanisms for allowing this to occur are discussed in detail in the following bottom-up description of our hierarchal compositional model. 2.2 Primitive Elements Primitive elements form the foundational layer of our model. Each type of source set, Sp, S, and Sd, contains its own type of primitive elements. Pitch sets include the following types of elements: * Absolute Pitches, which contain a pitch class and an octave, such as C4. * Pitch Classes, such as Ab. Each time an element of this type is expanded into a final vector, an octave is randomly added. * Simultaneous Pitches, which contain multiple absolute pitches or pitch classes that will sound as a chord, such as C-E5-G6. * Silence, which simply cause no pitch to be sounded in the final output vector for the duration indicated in the associated rhythm element in the output vector. Rhythm sets contain primitive elements which specify an absolute duration ranging from a thirty-second note to a whole note, and including triplet, quintuplet, and septuplet durations. In addition, rhythmic values can be "composite durations," expressed as an absolute duration times an integer multiplier, such as "six times an eighth-note quintuplet" or "four times a quarter-note triplet." Dynamic sets contain primitive elements made up of the traditional Italian markings, such as forte or mezzo-piano, ranging from ppp tojff. 2.3 Higher Layers Composite Element This layer contains either a primitive element or a reference to a set. Every primitive element is thus contained inside a composite element. Set As the primary unit of abstraction and encapsulation in our model and the fundamental building block of the composition, each set contains an ordered or unordered collection of composite elements. A set also contains the desired length of its expansion, although this may be overwritten by the length of its parent track (described shortly), if it belongs to one. Furthermore, a set contains a reference to the desired algorithmic operator used to expand it. Track The track layer contains all the source sets required to describe an arbitrarily long track of complete notes. For purposes of this discussion, this comprises source sets containing pitch, rhythm, and dynamic primitive elements, as well as the desired length of the track in terms of a note or beat count. Tracks may also include a desired timbre such as a MIDI patch. Session This layer forms the uppermost abstraction of a compositional session. Sessions include all tracks in the composition, "global" sets that can be referenced from all source sets of its same family, the desired tempo of the composition, and other system-level parameters. 3 Algorithmic Rules As discussed in the first section, the general equation of algorithmic expansion is E A(S). As shown in this general expansion equation, the algorithmic operator must accept a source set of composite elements and produce an output vector of primitive elements. Since the desired length of the output vector is only known at expansion time, the algorithmic operators must be able to produce an output vector of arbitrary length. We have identified and implemented four very simple algorithmic rules whose behavior is best described in terms of a source set S containing n primitive elements: S {Si, S2,..., Sn}, with a desired expansion length k. The behavior of the operators is summarized in the following list: * Sequential Expansion, which treats the source set as being linearly ordered. If the desired length is greater than the size of the source set, sequential expansion simply starts again at the beginning of the set. An expansion of set S will produce a vector of length k as follows: < si, S2,..., S i, S 3 2,..., Sn.** * Persistent Sequential Expansion is identical to sequential expansion except that the expansion position is preserved between expansions. This is useful in globallyvisible ordered sets that are expanded multiple times as subexpansions of a larger set. For example, if the set Proceedings ICMC 2004

Page  00000003 S4 contains four elements and is repeatedly expanded to produce three-element vectors as part of the expansion of a larger set, the following vectors show the first three subexpansions: < S1,S2,S3 > < S4, S, S2 > < S3, S4, S1 > * Random Expansion simply extracts the desired number of elements from S with uniform distribution, producing a vector of length k: <s: s S> * Permutation-Based Expansion is similar to random expansion, but it ensures that elements will not be repeated until all elements in the set have appeared in the output expansion vector. In other words, this algorithm builds an output vector by concatenating ceil (k) permutations of S and dropping elements from the end as necessary to create an expansion vector of length k. 4 Set Expansion Algorithms The set expansion algorithm includes provisions for handling nested subexpansions, as each main track set Sp, S,, and Sd will likely contain references to global sets. The listing uses ek to refer to the k-th element of the expansion E. In addition, A1 indicates to use the algorithmic rule referenced by the set to obtain the next expansion element. Algorithm 1 Set Expansion Algorithm i <-- 1 j -- desired expansion size, in terms of elements while i < j do curelement = A1 (S) if curelement is a primitive element then ei -- curelement i - i + 1 else C <- set referenced by curelement dessubexpsize <- expansion size preferred by C act_subexpsize -- min(dessubexpsize, j - i) D -- expansion of C of length act_subexpsize for k = 1 to act_subexp_size do ei -- di i - i + 1 end for end if end while The meta-expansion algorithm expands all necessary sets required to produce a final output vector for the entire algo rithmic passage. In our implementations, the final output has been a MIDI sequence, but in theory the final output vector could be in any type of musical file format. Regardless, the meta-expansion algorithm must expand all tracks in the current compositional session. Since each track contains a set for each element of music in consideration, the pitch, rhythm, and dynamic sets will be identified respectively as Sp, SS, and Sd. The meta-expansion algorithm simply calls the set expansion routines for these sets and consolidates the resultant expansions. Algorithm 2 Meta-Expansion Algorithm for all S E tracks do k <- desired expansion size E <-- k-element expansion of Sp E, <- k-element expansion of S, Ed -- k-element expansion of Sd E <--(Ep, E,, Ed) Store E as the expansion of this track end for Write all track expansions to disk 5 Software Implementation Our main purpose in creating this model was to construct a simple yet powerful method of creating algorithmic music. Our hope is that composers who would not otherwise climb the learning curve of a large, comprehensive, and complex software package would be able to quickly grasp the functioning of our set-based model and begin creating music. We implemented our ideas in a small program that attempts to demonstrate the flexiblity of our model without overwhelming the user with complexity. Although many highly capable computer-assisted composition systems have been developed that offer much greater flexibility and power, such as those described in (Assayag et al. 1999), a lightweight and userfriendly program that performs the algorithmic processes described in the preceeding sections is useful in its own right. We used MIDI throughout to preserve the simplicity of the implementation and to keep processing requirements to a minimum. However, the principles of our compositional model could be readily extended to digital audio, microtones, or any number of techniques or practices. 5.1 General Considerations One of our underlying assumptions was that many, if not most, composers do not want to be forced to learn a new Proceedings ICMC 2004

Page  00000004 computer syntax to create simple algorithmic textures. Instead of using a command interpreter, our program is based on a simple graphical user interface that displays state information and accepts user input. The program was writtin in generic C++ to enable us to produce versions for both Windows and Mac OS X using FLTK, a cross-platform user interface toolkit. Both versions are available at 5.2 Interface Design User interaction proceeds left-to-right across the interface in three phases (Figure 1). Users first create sets in the left panel, after which they set a tempo and press the large "Generate" button in the middle of the interface. The output is displayed in textual format on the right panel, and the playback controls offer a MIDI rendition of the algorithmic texture. Then, the user will likely edit the source sets, regenerate the music, listen again, etc. When the user is satisfied with the output, standard MIDI file export functionality is provided. Many users will then import the MIDI file into a music notation editor such as Finale, Sibelius, etc., and integrate the algorithmic music within the context of a larger, traditionally composed piece. Alternatively, the MIDI file could be rendered by synthesis equipment in its unmodified form, and integrated in a larger piece based on digital audio rather than a traditional score. 5.4 Example Figure 2 demonstrates some of the capabilities of our compositional model. The pitches of the upper voice are produced by a random expansion (produced by expanding an unordered set) of Db, Eb, E, F#, Ab, and Bb. The rhythm of the upper voice is straight eighth notes (produced by expanding a singleton set), and its dynamics follow a repetitive pattern of loud-soft-soft (a three-element ordered multiset). The pitches of the lower voice are an unordered expansion of a pitch set containing C, D, A, Bb, and a reference to an ordered global pitch set containing F, E, and Eb. When the reference to the global set is randomly chosen from the main unordered set, the subexpansion will always consist of the three ordered pitches, as evidenced by the three F-E-Eb sequences. The lower voice shows an isorhythm (produced by sequential set expansion) of two-eighths, quarter, eighth, two-sixteenths. Figure 2: Example generated music. 6 Future Work Future work could include digital audio or microtonal support, as previously discussed. However, the major focus of our current research involves extending the principles of our set-based model to real-time music generation, as opposed to the offline processing currently done in our software implementation. Set expansions could be triggered by a system timer, an external physical controller, or the real-time evolution of a complex system such as a cellular automaton. This effort involves drastic optimizations of our core algorithms in both time and space, and has the potential of leading to promising new interaction schemes and levels of computer assistance in the performative as well as compositional realms. References Assayag, G., C. Rueda, M. Laurson, C. Agon, and O. Delerue (1999). Computer-assisted composition at IRCAM: From patchwork to openmusic. Computer Music Journal 23(3), 59-72. Supper, M. (2001). A few remarks on algorithmic composition. Computer Music Journal 25(1), 48-53. Figure 1: Screenshot of the user interface of our freely available program built on the set-based compositional model. 5.3 Practicalities In practice, it seemed helpful to be able to "override" the rhythm and/or dynamic set expansion with a rhythm or dynamic supplied along with a pitch element. Because of its usefulness, we added this functionality to the program, even though it somewhat muddies the clarity of the model. Proceedings ICMC 2004