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.

Booleans<br />

<strong>The</strong> real-time evaluator can per<strong>for</strong>m all of the standard comparison operators. <strong>The</strong>y return 0 <strong>for</strong> false and<br />

1 <strong>for</strong> true.<br />

Message Example Result<br />

ne: (not equal) 3 ne: 2, 3 ne: 3 1, 0<br />

eq: (equal) 3 eq: 2, 3 eq: 3 0, 1<br />

gt: (greater than) 3 gt: 2, 3 gt: 3 1, 0<br />

lt: (less than) 3 lt: 2, 3 lt: 3 0, 0<br />

ge: (greater or equal) 3 ge: 2, 3 ge: 3 1, 1<br />

le: (less or equal) 3 le: 2, 3 le: 3 0, 1<br />

Conditionals<br />

neg:zero:pos: takes on one of three values, depending upon the value of the message receiver. All<br />

expressions are evaluated, but only one of the results is used, depending on whether the first expression<br />

has a negative, zero, or positive value. neg:zero:pos:initially: is the same as neg:zero:pos:<br />

except that you can specify the initial value of the entire expression. In neg:zero:pos:, the initial value<br />

of the entire expression is always 0. <strong>The</strong> expression takes on the initial value only <strong>for</strong> as long as the message<br />

receiver does not yet have a value (e.g. if it depends on an event that has not yet occurred).<br />

true:false: or false:true: does conditional evaluation of either the true argument or the false argument<br />

depending upon the value of a test expression. It evaluates only one, not both of the true and<br />

false arguments. For this conditional, true is considered to be any positive number, false is any zero or<br />

negative number.<br />

Message Example Result<br />

neg:zero:pos: -1 neg: 4 zero: 3 pos: 2 4<br />

neg:zero:pos:initially: 1 neg: 4 zero: 3 pos: 2 initially: 8 2<br />

true:false: 0 true: 3 false: 2, 0.5 true: 5 false: 6 2, 5<br />

false:true -2 false: 0 true: 100, 10 false: 40 true: 60 0, 60<br />

Conversions<br />

<strong>Kyma</strong> considers positive numbers as boolean true values and zero or negative numbers as boolean false<br />

values. asLogicValue maps all true values to 1 and all false values to 0.<br />

You can use db to convert a decibel value into its linear equivalent. 0 db is equal to 1 or full amplitude,<br />

and increases of 6 db double the amplitude, and decreases of 6 db halve the amplitude.<br />

inSOSPitch converts a frequency in hertz or pitch in note numbers to a pitch in the same <strong>for</strong>mat and<br />

range as the output of the spectral sources (e.g. SpectrumInRAM, SyntheticSpectrumFromArray, etc.).<br />

<strong>The</strong>se pitches map the range from 0 hz through 22050 hz to a log curve drawn between 0 and 1. Every<br />

doubling of the frequency in hertz corresponds to adding 1/15 to the number in SOS pitch, so at 22050 hz,<br />

the SOS pitch is 1, at 11025 hz it is 1-(1/15), and so on.<br />

Message Example Result<br />

asLogicValue -2 asLogicValue, 0 asLogicValue, 3 asLogicValue 0, 0, 1<br />

db 0 db, 6 db, -6 db, -12 db 1.0, 1.99, 0.5, 0.25<br />

inSOSPitch 22050.0 hz inSOSPitch, 1378.12 hz inSOSPitch 1.0d, 0.73<br />

478

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

Saved successfully!

Ooh no, something went wrong!