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.

Sequences and Mixes<br />

An EventSequence is a collection of events that occur in time order. <strong>The</strong> syntax <strong>for</strong> creating an EventSequence<br />

is:<br />

EventSequence events: anArray.<br />

An EventMix is a collection of events that occur at the same time. <strong>The</strong> syntax <strong>for</strong> creating an EventMix is:<br />

EventMix events: anArray.<br />

<strong>The</strong>re are several ways to create the Array. You can specify each item in the array:<br />

EventSequence events:<br />

(Array<br />

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

with: (Note durationInBeats: 1 frequency: 4 e)<br />

with: (Note durationInBeats: 2 frequency: 4 c))<br />

You can collect items that you create within a loop:<br />

EventSequence events:<br />

((1 to: 100) collect: [ :i |<br />

Note durationInBeats: 2 frequency: 4 c + (i * 2) nn])<br />

Or you can put literal values within parentheses preceded by a sharp sign. If you create the Array this<br />

way, remember to enclose the Notes and Rests within curly braces to make them literal values:<br />

EventMix events:<br />

#( {Note durationInBeats: 1 frequency: 3 g}<br />

{Note durationInBeats: 1 frequency: 4 e}<br />

{Note durationInBeats: 2 frequency: 4 c} )<br />

TimedEventCollections<br />

A TimedEventCollection is a collection of events together with the starting beat <strong>for</strong> each event. One way<br />

to create a TimedEventCollection is:<br />

TimedEventCollection startingBeats: beats events: events.<br />

where beats is a collection of the starting beat numbers <strong>for</strong> each event in the events collection.<br />

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

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

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

MIDI file into a TimedEventCollection you can trans<strong>for</strong>m it, twist it, distort it, in short, do all the kinds<br />

of things composers love to do!<br />

<strong>The</strong> syntax <strong>for</strong> reading a MIDI file is:<br />

TimedEventCollection timesAndEventsFromMIDIFile: 'file.mid' channel: 1.<br />

Generic EventCollections<br />

An EventCollection is a collection of Notes and Rests without any ordering. To create an EventCollection,<br />

use:<br />

EventCollection events: anArray.<br />

Where anArray is a collection of Notes, Rests and other collections of events.<br />

<strong>The</strong> message randomizeUsing:totalBeats:quantizeTo:maxSpacing: <strong>for</strong>ces an EventCollection<br />

to become a TimedEventCollection by generating a set of random starting beats and randomly picking a<br />

set of events from the events supplied:<br />

(EventCollection events: anArray)<br />

randomizeUsing: (Random newFor<strong>Kyma</strong>WithSeed: 92)<br />

totalBeats: 16<br />

524

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

Saved successfully!

Ooh no, something went wrong!