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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

For example, to set controller number 7 to the value 0.5 at time 0, you would type:<br />

self controller: !cc07 setTo: 0.5 atTime: 0 s.<br />

To cause a gradual increase in its value from 0.5 up to 1 by the time 5 seconds has been reached, you<br />

would type:<br />

self controller: !cc07 slideTo: 1.0 byTime: 5 s.<br />

If you want to make sure that the transition sounds smooth and continuous, you can control the size of<br />

the individual steps. For example,<br />

self controller: !Frequency slideTo: 1.0 stepSize: 0.1 byTime: 10 s.<br />

would use steps of one tenth of a hertz if !Frequency were in units of hertz.<br />

Alternatively, you can specify the number of steps it should take to get from one value to the other. For<br />

example,<br />

self controller: !Morph slideTo: 1.0 steps: 100 byTime: 3 s.<br />

would send 100 updates to the value of !Morph over the course of 3 seconds.<br />

Although it might initially seem that you should always send a huge number of steps or set the step-<br />

Size to a very small value, there is a tradeoff to consider. If you are using many controllers and each<br />

controller is sending many updates, you can start loading down the Capybara with too many events. If<br />

the load gets too heavy, it could start interfering with the actual sound generation. So in algorithmic<br />

events, as in all things, use moderation.<br />

<strong>The</strong> Power of Programming<br />

You might well ask yourself at this point, “Why type all that stuff when I can just play the same thing on<br />

the keyboard and record it in my MIDI sequencer?” Good question! Because if all you did in the MIDI-<br />

Voice or MIDIMapper Script was to type each individual event, then you would be much better off<br />

using sequencing software instead.<br />

<strong>The</strong> real power of the script begins to emerge when you embed these event-generators in some programming<br />

control structures. To really see how to do this, you should read about MIDI Scripts on page<br />

522. But just to give you a little appetizer, consider this. If you put a single keyboard event into a loop,<br />

and change its settings each time through the loop, you can generate hundreds of events with just a few<br />

lines of code. For example, here is a script that will generate 500 random notes:<br />

| r t |<br />

r := Random newFor<strong>Kyma</strong>WithSeed: 52.<br />

t := 0.<br />

500 timesRepeat: [<br />

self<br />

keyDownAt: t s<br />

duration: (r next + 1) s<br />

frequency: 3 c + (r next * 36 nn)<br />

velocity: r next.<br />

t := t + r next].<br />

and to generate 1000 notes, you would just change the 500 to 1000 (or whatever number you like!)<br />

EventCollections<br />

For many kinds of music, it makes more sense to think in terms of notation than in terms of times in seconds.<br />

EventCollections provide a way to specify notes and rests, rather than start times in seconds. For<br />

the full story, see MIDI Scripts on page 522.<br />

56

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

Saved successfully!

Ooh no, something went wrong!