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.

Event Collections<br />

Note that !KeyNumber can take on non-integer values and has 16 fractional bits, giving a pitch accuracy<br />

of 0.0015 cents <strong>for</strong> events generated by MIDVoice and MIDIMapper scripts. !PitchBend is not used to<br />

get these non-integer values.<br />

To specify a value <strong>for</strong> a continuous controller in a MIDI script, use either:<br />

self controller: aName setTo: aValue atTime: aTime.<br />

to cause the controller to jump immediately to a specified value at a specified time, or<br />

self controller: aName slideTo: aValue steps: nbrSteps byTime: aTime.<br />

to cause the controller to slide from its previous value to the specified value by the specified time in the<br />

specified number of steps, or<br />

self controller: aName slideTo: aValue stepSize: step byTime: aTime.<br />

if you prefer to specify the size of each step, rather than the total number of steps.<br />

For example, to cause !Frequency to move from 100 to 1000 over 10 seconds, starting at 30 seconds, you<br />

could use:<br />

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

self controller: !Frequency slideTo: 1000 steps: 100 byTime: 40 s.<br />

Sometimes it is more convenient to specify the MIDI events as collections of notes and rests, without<br />

having to specify start times <strong>for</strong> each event. <strong>The</strong> actual start times can be inferred from the duration of the<br />

Note or Rest and where it occurs in the collection of events. This corresponds more closely to written music<br />

notation, where note and rest symbols arranged horizontally are interpreted as a sequence of events in<br />

time (where each event’s start time occurs immediately after the previous event’s duration has expired),<br />

and notes or rests arranged vertically are interpreted as all starting at the same time.<br />

In the MIDI script language, an EventSequence is a collection of Notes, Rests, or other EventCollections<br />

that occur one after another in time (corresponding to horizontal placement in music notation). Since you<br />

can also construct sequences of other collections, you can create higher level structures as well. For example,<br />

sequences of Notes and Rests could be collected in a measure; sequences of measures could be<br />

collected into a phrase; sequences of phrases could be collected into sections; sequences of sections could<br />

be collected into movements, etc. until you run out of traditional musical names <strong>for</strong> the structures(!)<br />

An EventMix is a collection of Notes, Rests, or other EventCollections that occur all at the same time<br />

(corresponding to vertical placement in music notation). Like an EventSequence, the EventMix is recursively<br />

defined (i.e. you could have an EventMix of EventMixes), allowing you to define hierarchical<br />

structures, somewhat analogously to the way you can define <strong>Sound</strong>s.<br />

You can also create a generic EventCollection of Notes, Rests, or other EventCollections, specifying that<br />

you haven’t yet decided whether the events should be simultaneous or sequential but will send a message<br />

to the object later to specify actual start times and turn it into a sequence or a mix of other events.<br />

Notes and Rests<br />

<strong>The</strong> syntax <strong>for</strong> creating a single Rest is:<br />

Rest durationInBeats: aDurInBeatsWithNoUnits.<br />

To create a Note, you can use:<br />

Note durationInBeats: aDur frequency: freqWithUnits velocity: aVel.<br />

You can leave off any of the tags if you don’t mind using the default values <strong>for</strong> those parameters.<br />

Examples of creating Rests and Notes:<br />

| n1 n2 n3 |<br />

n1 := Note durationInBeats: 2 frequency: 2 g.<br />

r2 := Rest durationInBeats: 1.<br />

n3 := Note durationInBeats: 2 frequency: 2 d.<br />

523

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

Saved successfully!

Ooh no, something went wrong!