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.

snd duration: (1.0 / snd frequency hz).<br />

In this case, the duration of the input will be exactly one cycle long.<br />

If a trans<strong>for</strong>ming statement tries to per<strong>for</strong>m arithmetic on a parameter name that is not present in the input<br />

or one of its inputs, <strong>Kyma</strong> will return an error message, in<strong>for</strong>ming you that a message was sent to<br />

nil. For example, suppose the current <strong>Sound</strong> lacks the parameter CmRatio. When <strong>Kyma</strong> encounters the<br />

trans<strong>for</strong>ming statement<br />

snd frequency: snd cmRatio * 0.5.<br />

you will get an error <strong>for</strong> trying to multiply nil by 0.5. To protect against using nil in a calculation, test<br />

the value and only per<strong>for</strong>m the calculation if the value is not nil. For example, the following trans<strong>for</strong>ming<br />

statement is protected against calculating with nil:<br />

snd cmRatio isNil ifFalse: [snd frequency: snd cmRatio * 0.5].<br />

<strong>The</strong> effect is to set the frequency to cmRatio * 0.5 in <strong>Sound</strong>s where CmRatio is present and to skip over<br />

<strong>Sound</strong>s where that parameter is absent.<br />

Time-varying Trans<strong>for</strong>mations<br />

Skipping Levels<br />

Two values, time and totalDuration, are available in ParameterTrans<strong>for</strong>mers. <strong>The</strong> value of time is<br />

the start time in microseconds of the <strong>Sound</strong> being trans<strong>for</strong>med. <strong>The</strong> value of totalDuration is the duration<br />

in microseconds of the ParameterTrans<strong>for</strong>mer’s input. You can use time and totalDuration to<br />

construct trans<strong>for</strong>mations that depend on the start time of a input within the structure.<br />

Suppose the input of a ParameterTrans<strong>for</strong>mer is a Repetition of an Oscillator.<br />

<strong>The</strong> result of the trans<strong>for</strong>mation<br />

snd frequency: snd frequency * (1 + (time / totalDuration)).<br />

is a sequence of <strong>Sound</strong>s with higher and higher frequencies.<br />

Trans<strong>for</strong>mations are made to the initial values of a <strong>Sound</strong>’s parameters; thus, any variation in the trans<strong>for</strong>mation<br />

over time is manifested only at the start time of each <strong>Sound</strong>, not over the course of a <strong>Sound</strong> and<br />

not on a sample-by-sample basis.<br />

In the default case, a trans<strong>for</strong>mation is applied to each level of the input’s structure. If you want to stop<br />

the trans<strong>for</strong>mation from continuing beyond a certain level of the sound structure, use<br />

snd doNotTrans<strong>for</strong>mSub<strong>Sound</strong>s.<br />

To continue applying trans<strong>for</strong>mations to inputs, use<br />

snd trans<strong>for</strong>mSub<strong>Sound</strong>s.<br />

544

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

Saved successfully!

Ooh no, something went wrong!