Setting ranges for expressions, Modifying noise – Apple Shake 4 User Manual

Page 950

Advertising
background image

950

Chapter 31

Expressions and Scripting

You might have guessed that rnd(1.05) is between those, but it in fact equals .0174, not
.458. This is why it is called discontinuous noise. Examining the neighboring values
does not help you to arrive at a safe guess for the in-between values. For this reason,
frequency changes have no practical effects on the curve.

Setting Ranges for Expressions

The noise generators return values between 0 and 1. sin() and cos() return values
between -1 and 1. To adjust the range, use addition and multiplication. For example,
suppose you want to spit out values between 100 and 400. To make a noise generator
do that, subtract the low value from the high value. This is your multiplier. Then add the
lower value of your range. Thus, you have:

noise(time)*300+100

As cos and sin return values between -1 and 1, you have to offset the output by 1 and
multiply by half of the difference between the two:

(sin(time)+1)*150+100

Modifying Noise

You can use other functions like ceil(), floor(), or round() to help you break a curve into
steps. Ceiling pushes a number to the next highest integer, floor drops it to the next
lowest, and round rounds off the value.

rnd(time)

noise(time)

noise(time)*300+100

Advertising