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.

<strong>The</strong> first example is called Kurt’s Rhythmic Pulsation. It uses a <strong>Sound</strong> called thump that has variables<br />

?frequency and ?cycles.<br />

"Set the metronome to 300 beats per minute."<br />

MM := 300.<br />

"Set i to the values 0, 1, … 200 on each iteration."<br />

0 to: 200 do: [ :i |<br />

"If i mod 4 is 0 (i.e. if i is a multiple of 4), then start the instrument<br />

called thump at i beats with a frequency of 100 hertz and 25<br />

cycles within each envelope."<br />

i \\ 4 = 0 ifTrue: [<br />

thump start: i beats<br />

"etc…" i \\ 2 = 0 ifTrue: [<br />

frequency: 100 hz<br />

cycles: 25].<br />

thump start: i beats<br />

frequency: 250 hz<br />

cycles: 25].<br />

i \\ 3 = 0 ifTrue: [<br />

thump start: i beats<br />

frequency: 150 hz<br />

cycles: 25].<br />

"If i is less than 50 AND i is a multiple of 5, then start the instrument<br />

called thump at i beats with a frequency of 400 hertz and 25<br />

cycles within each envelope."<br />

(i < 50 and: [i \\ 5 = 0]) ifTrue: [<br />

thump start: i beats<br />

frequency: 400 hz<br />

cycles: 25].<br />

i \\ 13 = 0 ifTrue: [<br />

thump start: i beats<br />

frequency: 700 hz<br />

cycles: 25].<br />

i \\ 7 = 0 ifTrue: [<br />

thump start: i beats<br />

frequency: 50 hz<br />

cycles: 50].<br />

"If i is greater than 50 AND i is not a multiple of 7, 5 or 3, then<br />

start the instrument called thump at i beats with a frequency of 1000<br />

hertz and 100 cycles within each envelope."<br />

(i > 50 and: [i \\ 7 ~= 0<br />

and: [i \\ 5 ~= 0 and: [i \\ 3 ~= 0]]])<br />

ifTrue: [<br />

thump start: i beats<br />

frequency: 1000 hz<br />

cycles: 100].<br />

"End of 0 to: 200 do: loop."<br />

].<br />

533

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

Saved successfully!

Ooh no, something went wrong!