In lieu of an abstract, here is a brief excerpt of the content:

213 Chapter 16 Extended Examples One of the difficulties of writing about programming of any kind is that realistic examples are simply too big and full of uninteresting detail for ordinary reading. Consequently, we, as authors, try to distill examples down to their essential elements and hope the reader will understand how to apply these elements in larger, more realistic contexts. In this chapter, we will present “real” examples in the hope that seeing larger programs will help to clarify the process of algorithmic composition and prepare the reader to work beyond the “toy” examples seen so far. The first program describes the development of a piece of music by Roger Dannenberg for the soundtrack of a multimedia science show on tissue engineering . The second program is based on the work of Edwin Shao, who developed algorithms for converting text to music as an undergraduate class project at Carnegie Mellon University. 16.1 Jellyfish Music Example This is a personal account of a compositional process, so I will use the first person for my description. My task was to create the entire soundtrack for a multimedia show on tissue engineering that was designed for presentation in a planetarium. (Although planetaria are designed to project star fields and teach the public about astronomy, they are usually equipped with multiple image projectors, multichannel sound diffusion, and automated control, making them ideal for multimedia presentations of all kinds.) I will describe the music for one short scene that included beautiful images of jellyfish. There is a voice-over that runs throughout the scene, so one challenge was to coordinate the music with the voice, working with it rather than competing with it. I used algorithmic composition mainly so that I could adjust the structure, harmony, and durations without extensive rewriting. That way, if the music, voice, and images did not work well together, I could make changes rather easily. This music was originally created in Nyquist before the pattern generator library (xm.lsp) was available. I have attempted to recreate the development process using the methods and software described in this book. 214 Chapter 16 ⋅ Extended Examples I began by improvising1 at a synthesizer keyboard. I found a simple texture that sounded promising, created from a few note choices under each hand. I observed that I was mainly alternating left and right hands and avoiding note repetitions in either hand. For example , if the left hand played an F, it would typically be followed by a note in the right hand, and that would likely be followed by a note in the left hand that was not an F. This led to a more formal description of a generative algorithm: Start with two sets of pitches named lh and rh. Construct a melody as a sequence of pitches, where each pitch is chosen as follows: First, select a set (either lh or rh). Favor the set that has been selected fewer times in the past. Next, select a pitch from the set. Do not choose the same pitch that was selected last time, and avoid pitches that have been selected recently. This description is practically calling for pattern generators. Selecting a set (lh or rh) can be accomplished with weighted random selection, and pitch selection can use a heap pattern. Let’s create a simple test and listen to the results: Example 16.1.1: jellyfish-1.sal define function j1( beatdur, notes, lh-heap, rh-heap, notedur) begin with lh-pat = make-heap(lh-heap, for: 1), rh-pat = make-heap(rh-heap, for: 1), p-pat = make-random(list(lh-pat, rh-pat)) return score-gen(score-len: notes, save: quote(j1-score), dur: notedur, ioi: beatdur, vel: real-random(70, 120), pitch: next(p-pat)) end exec score-play(j1(0.35, 20, list(g3, ef4, f4), list(g4, bf4, c5, d5), 0.5)) Example 16.1.1 uses make-heap to select from left-hand and right-hand pitch sets, and make-random is used to select which hand will play the next pitch. Note that for: 1 is used with makeheap ; otherwise, after make-random selected a hand, the hand pattern would be called to play all of its pitches before selecting the next 1 Given my keyboard skills, “noodling” might be a better term. [3.144.151.106] Project MUSE (2024-04-25 12:55 GMT) 16.1 Jellyfish Music Example 215 hand to play. Using for: 1 tells the hands to play periods of length 1...

Share