09.12.2012 Views

The Kyma Language for Sound Design, Version 4.5

The Kyma Language for Sound Design, Version 4.5

The Kyma Language for Sound Design, Version 4.5

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>The</strong> next example is called Serial Example. In this example, inst takes two arguments: offset and<br />

sound. <strong>The</strong> argument sound must be another <strong>Sound</strong>; in this case it is called aPluck. <strong>The</strong> <strong>Sound</strong> aPluck<br />

also takes two arguments: left and right. Notice that whenever aPluck is provided as the argument to<br />

inst, aPluck is not assigned a start time.<br />

inst looks at the pitch of its <strong>Sound</strong> argument and adds the value of offset to that pitch. For instance, if<br />

the frequency of aPluck were 4 a and the offset were 3, the result would be a copy of aPluck whose<br />

frequency was 5 c.<br />

In this example, p0 is an array of intervals that determines the sequence of pitches and the start times of<br />

aPluck.<br />

| p0 start |<br />

MM := 480.<br />

"Set p0 to an array of 12 intervals, expressed as the number of half<br />

steps to be added to the pitch of aPluck."<br />

p0 := #(0 1 11 5 2 4 3 9 10 6 8 7).<br />

start := 0 beats.<br />

"Step <strong>for</strong>ward through p0 by setting i to 1, 2,.., 12 successively and<br />

using it as the index into the array. Each copy of inst starts (p0 at:<br />

i) beats after the previous one. <strong>The</strong> pitch of each copy of inst is the<br />

pitch of aPluck plus the offset (p0 at: i) halfsteps. For example, on<br />

the third time through the loop, (p0 at: i) = 5. Thus, a copy of inst<br />

will start 5 beats after the previous copy and its pitch will be the<br />

pitch of aPluck plus 5 halfsteps."<br />

1 to: 12 do: [ :i |<br />

start := start + (p0 at: i).<br />

inst<br />

start: start beats<br />

offset: (p0 at: i)<br />

sound: (aPluck left: 1 right: 1)].<br />

"r5: This time, step backwards through the array, and start 5 halfsteps<br />

above the base pitch. Reset start so that these events overlap some of<br />

the previously scheduled events."<br />

start := 6.<br />

12 to: 1 by: -1 do: [ :i |<br />

start := start + (p0 at: i).<br />

inst start:<br />

start beats<br />

offset: (p0 at: i) + 5<br />

sound: (aPluck left: 0 right: 1)].<br />

"ri0: This time, go through the array backwards, negate each of the<br />

offsets, and subtract 24 (i.e. transpose them two octaves down). Reset<br />

start so that these events occur simultaneously with the events of r5."<br />

start := 6.<br />

12 to: 1 by: -1 do: [ :i |<br />

start := start + (p0 at: i).<br />

inst<br />

start: start beats<br />

offset: (p0 at: i) negated - 24<br />

sound: (aPluck left: 0.6 right: 0)].<br />

"Play a low frequency sound starting at 9 seconds."<br />

low<br />

start: 9 s<br />

carFreq: 100 hz<br />

534

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!