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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong>n, starting on beat 0, we play the events (after scaling all the !KeyVelocity values to one quarter of<br />

their original values; look at the Pan to see how we have twisted the meaning of !KeyVelocity to really<br />

control stereo placement):<br />

(prime velScale: 0.25) playOnVoice: self onBeat: 0 bpm: 400.<br />

On beat 11, we start up another copy of the TimedEventSequence, this one inverted about 3 a and placed<br />

in the opposite channel:<br />

((prime inv: 3 a) velScale: 0.75) playOnVoice: self onBeat: 11 bpm: 400.<br />

TimedEventCollections Read from MIDI Files<br />

You can also create a TimedEventCollection by reading in the events and starting beats from a MIDI file.<br />

If you want to play exactly what’s in the MIDI file, it would be quicker and more straight<strong>for</strong>ward to simply<br />

select MIDI file as the Source in your MIDIVoice. However, once you have read the MIDI file into a<br />

script you can trans<strong>for</strong>m it, twist it, distort it, in short, do all the kinds of things composers love to do!<br />

For example, take a look at the Script <strong>for</strong> the <strong>Sound</strong> called trans<strong>for</strong>m events from MIDI file:<br />

| pat |<br />

pat :=<br />

TimedEventCollection<br />

timesAndEventsFromMIDIFile: 'omino.mid'<br />

channel: 1.<br />

(pat inv: 60 nn) playOnVoice: self onBeat: 5 bpm: 120.<br />

(pat trsp: 31) retrograde playOnVoice: self bpm: 120.<br />

In this script, pat is a TimedEventCollection whose start times and events are read from channel 1 of<br />

MIDI file omino.mid. To hear the original MIDI file, select MIDI file as the Source, and play. <strong>The</strong>n select<br />

Script as the Source and play again to hear the trans<strong>for</strong>med file. Type the name of one of your own<br />

MIDI files in place of omino.mid and try it again.<br />

Generic EventCollections<br />

In randomized times on event collection, you can see an example of a generic EventCollection, one that is<br />

not yet ready to make a commitment to full seriality or simultaneity:<br />

| pat pat2 pat1 |<br />

pat :=<br />

EventCollection events: (Array<br />

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

with: (Note frequency: 3 f durationInBeats: 1)<br />

with: (Note frequency: 3 a sharp durationInBeats: 1)<br />

with: (Note frequency: 3 b sharp durationInBeats: 1)).<br />

But the message randomizeUsing:totalBeats:quantizeTo:maxSpacing: changes the Event-<br />

Collection into a TimedEventCollection by generating a set of random starting beats and randomly<br />

picking a set of events from the events supplied. You specify the total duration of the result, the smallest<br />

distance between beats (with quantizeTo:) and the longest time between beats (maxSpacing:):<br />

pat1 :=<br />

pat<br />

randomizeUsing: (Random new seed: 92)<br />

totalBeats: 16<br />

quantizeTo: 0.5<br />

maxSpacing: 1.<br />

143

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

Saved successfully!

Ooh no, something went wrong!