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.

EventMix<br />

Play the example called out-o-tune, and then edit the <strong>Sound</strong> to examine its script. This is an example of<br />

creating and using an EventMix.<br />

First we declare the variables within vertical lines. <strong>The</strong>n we set the variable chord to an EventMix. In<br />

this case, the chord is constructed out of perfect fourths above 3 d — and these are really perfect fourths,<br />

because we constructed them by scaling the frequency of 3 d (obtained by sending the message hz to 3 d)<br />

by the ratio 4/3.<br />

| chord seq |<br />

chord :=<br />

EventMix events: (Array<br />

with: (Note durationInBeats: 2 frequency: 3 d)<br />

with: (Note durationInBeats: 2 frequency: 3 d hz * 4/3)<br />

with: (Note durationInBeats: 2 frequency: 3 d hz * (4/3 ** 2))<br />

with: (Note durationInBeats: 2 frequency: 3 d hz * (4/3 ** 3))<br />

).<br />

Next, we construct a sequence of these chords. Each chord has all of its frequencies scaled by 4/3 above<br />

the frequencies of the previous chord. In order to do frequency scaling (multiplying the frequencies by a<br />

value) rather than pitch transposition (adding a value to the note number), we use the trans<strong>for</strong>mation<br />

freqScale: rather than the trans<strong>for</strong>mation trsp:.<br />

seq :=<br />

EventSequence events: (Array<br />

with: chord<br />

with: ((chord freqScale: 4/3) dim: 0.125)<br />

with: (chord freqScale: 16/9)).<br />

seq playOnVoice: self bpm: 60.<br />

Finally, the controller called !Frequency is set to start out at 0 and, at the time 3 seconds, to drop down<br />

to -36 in 60 steps over the course of one second. Notice that you can assign any values to controllers in<br />

the MIDI script; they are not limited to a range of (0,1) or (0,127):<br />

self controller: !Frequency setTo: 0 atTime: 0 s.<br />

self controller: !Frequency setTo: 0 atTime: 3 s.<br />

self controller: !Frequency slideTo: -36 steps: 60 byTime: 4 s.<br />

TimedEventCollections<br />

Take a look at (and have a listen to) serial time points. This script contains an example of a TimedEventCollection:<br />

a set of events associated with a set of starting beats. First, we declare the variables,<br />

define a set of intervals, and a collection of events based on those intervals:<br />

| set evs beats prime t |<br />

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

evs :=<br />

set collect: [ :int |<br />

Note durationInBeats: int frequency: 3 a + int nn].<br />

Next, we derive a set of starting beats from the set. <strong>The</strong> distance from one beat to the next comes from the<br />

set:<br />

t := 0.<br />

beats := set collect: [ :int | t := t + int].<br />

Here is where we create the TimedEventCollection:<br />

prime := TimedEventCollection startingBeats: beats events: evs.<br />

142

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

Saved successfully!

Ooh no, something went wrong!