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.

Now let’s make a trans<strong>for</strong>mation that depends on the start time of the <strong>Sound</strong> being trans<strong>for</strong>med. <strong>The</strong> reserved<br />

word time always contains the time offset of snd in microseconds. <strong>The</strong> reserved word<br />

totalDuration contains the total duration of the ParameterTrans<strong>for</strong>mer’s immediate input; it too is<br />

given in microseconds. Try the following Trans<strong>for</strong>mation:<br />

snd frequency isNil ifFalse: [<br />

snd frequency:<br />

(snd frequency nn -<br />

(3 * (time / totalDuration)) nn)].<br />

As time progresses from zero up to the number of microseconds in the total duration, the value of (time<br />

/ totalDuration) progresses from zero up to one. <strong>The</strong> frequency of the first note has zero half steps<br />

subtracted from it: no change at all; however, as time goes on, each subsequent note has larger and larger<br />

fractions of 3 half steps subtracted from its pitch.<br />

Not only can a new parameter value depend on time and its current value, it can also depend on the values<br />

of other parameters or combinations of parameter values. Try the following Trans<strong>for</strong>mation:<br />

snd duration isNil ifFalse: [<br />

snd frequency: snd duration inverse * 100].<br />

This trans<strong>for</strong>mation sets the Frequency to 100 times the inverse of whatever the Duration happens to<br />

be.<br />

Next, open the <strong>Sound</strong> file ParameterTrans<strong>for</strong>mer from the Advanced folder. Try playing the <strong>Sound</strong><br />

independent partials; when it asks <strong>for</strong> a frequency, enter 100 hz. Inspect independent partials; by double-clicking<br />

on it and looking at the Frequency field of each Oscillator. <strong>The</strong> first Oscillator’s frequency<br />

is ?frequency, the second one is ?frequency * 2, the third is ?frequency * 3, etc. When you play<br />

independent partials, it sounds like a single, harmonic tone.<br />

Edit the <strong>Sound</strong> called trans<strong>for</strong>mIndependentPartials by double-clicking on it. <strong>The</strong> Trans<strong>for</strong>mation<br />

parameter has a long comment, after which it should read:<br />

snd frequency isNil ifFalse: [<br />

snd frequency:<br />

snd frequency nn + (110.0 hz * time / totalDuration)].<br />

Reading this, we would expect that each repetition of independent partials will be at a higher frequency.<br />

When you play trans<strong>for</strong>m independent partials you hear, as expected, the frequencies getting higher with<br />

each repetition. What you may not have expected is that the sound starts out harmonic and becomes inharmonic<br />

with subsequent repetitions. Why is that?<br />

<strong>The</strong> sequence of events is:<br />

1. <strong>Kyma</strong> sets the Oscillator frequencies to 100 hz, 200 hz, etc.<br />

2. <strong>The</strong> ParameterTrans<strong>for</strong>mer adds a multiple of 110 hz to each repetition of independent partials.<br />

Since it adds a fixed amount to each frequency, the harmonic relationship is no longer maintained. For<br />

example, if you start out with 100, 200, and 300 hz and then you add 110 to each frequency, the result is:<br />

210, 310, and 410 hz. Since 410 hz is not a multiple of the lowest frequency, 210 hz, it is not a harmonic of<br />

210 hz.<br />

Is it possible to trans<strong>for</strong>m the frequencies in such a way as to maintain the harmonic relationship? One<br />

way would be to multiply the frequencies by a constant rather than adding a constant value to them. Another<br />

way is to create a new <strong>Sound</strong> class that maintains the harmonic relationship no matter what.<br />

Select independent partials in the <strong>Sound</strong> file window and choose New class from example from the Action<br />

menu. When <strong>Kyma</strong> asks <strong>for</strong> a value <strong>for</strong> ?frequency, enter 100 hz. Change the name of the new<br />

class from newClassFromExample to HarmonicPartials. <strong>The</strong>n uncheck Expand; this tells the<br />

<strong>Sound</strong>: Apply the trans<strong>for</strong>mation to yourself be<strong>for</strong>e you expand. If you leave Expand checked, then the<br />

<strong>Sound</strong> will expand first and then apply the trans<strong>for</strong>mation to the expanded version of itself.<br />

Close the class editor and answer that you want to save an instance of the new class; you should see a<br />

new <strong>Sound</strong> called HarmonicPartials in your <strong>Sound</strong> file window. In the open <strong>Sound</strong> editor, replace inde-<br />

200

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

Saved successfully!

Ooh no, something went wrong!