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.

Scale and Offset<br />

90% of all arithmetic that you will need in parameter fields will fit the same basic pattern. Most of the<br />

time, we want to change the range of a fader to be something other than 0 to 1. So most of our expressions<br />

will look something like this:<br />

!Fader * range + minimum<br />

To change the range of a fader that goes from 0 to 1, multiply it by the range you really want. For example,<br />

if you want your frequencies to have a range of one octave, you could multiply (or scale) the<br />

!Frequency fader by 12 half steps:<br />

!Frequency * 12 nn<br />

That would give you a range of note numbers from 0 to 12. Note number 0 is pretty low, so you probably<br />

would want to give it a different minimum note number. To set the minimum, you could add to (or<br />

offset) your value:<br />

!Frequency * 12 nn + 60 nn<br />

Now your !Frequency fader covers the range from middle C (note number 60) to one octave higher<br />

(note number 72).<br />

Sometimes multiplying is called scaling, because it retains the shape of the function, and just scales its<br />

size:<br />

⇒<br />

And sometimes adding a constant number is called adding an “offset”, because it doesn’t change the<br />

shape or the size of the function, it just shifts the whole thing up or down — setting it off from the original<br />

axis. You may have encountered this terminology be<strong>for</strong>e in the <strong>for</strong>m of “DC offset”, when some<br />

constant voltage is added to your audio signal, shifting it up or down with respect to zero.<br />

⇒<br />

In some of the <strong>Kyma</strong> documentation and nomenclature, you will see the words, scale, offset or<br />

ScaleAndOffset to mean multiply and add.<br />

Minus 1<br />

One version of the scale and offset that comes up fairly often in <strong>Kyma</strong> is the one that takes you from the<br />

range of (0,1) to the range (-1,1). Since the range of a <strong>Sound</strong>’s output is typically (-1,1) and the<br />

44

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

Saved successfully!

Ooh no, something went wrong!