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.

MIDIVoice Scripts<br />

<strong>The</strong> MIDIVoice and MIDIMapper modules give you three choices <strong>for</strong> the source of MIDI events: the live<br />

MIDI input stream (originating with external controllers or a sequencer or other software running in parallel<br />

with <strong>Kyma</strong>), a MIDI file stored on disk, or a MIDI script (which generates MIDI events<br />

algorithmically and then emits them).<br />

<strong>The</strong>se examples illustrate some of the tools <strong>for</strong> algorithmically generating MIDI events using the Script<br />

parameter of a MIDIVoice or MIDIMapper. For more in<strong>for</strong>mation about MIDI event scripts, see MIDI<br />

Scripts beginning on page 522.<br />

Notes and Controllers<br />

Notes<br />

<strong>The</strong> syntax <strong>for</strong> a basic note-on event is:<br />

self keyDownAt: aTime duration: aDur frequency: aFreq velocity: 0To1.<br />

When you drop the velocity tag, the event defaults to a velocity of 1.<br />

Transcription of Short Sequences<br />

Take a look at (and compile, load, start) machautKyrie to see a simple application of these note events:<br />

direct transcription of written notation by hand into MIDI script events. For short note sequences, entering<br />

the events by hand is often the quickest and most straight<strong>for</strong>ward way to do it. Here is an excerpt<br />

from the Machaut example:<br />

MM := 90.<br />

"------------------------------------"<br />

self keyDownAt: 0 beats duration: 3 beats frequency: 4 a.<br />

self keyDownAt: 3 beats duration: 1 beat frequency: 4 a.<br />

self keyDownAt: 4 beats duration: 1 beat frequency: 4 b.<br />

self keyDownAt: 5 beats duration: 1 beat frequency: 4 g.<br />

self keyDownAt: 6 beats duration: 2 beats frequency: 4 a.<br />

self keyDownAt: 8 beats duration: 0.5 beats frequency: 4 f.<br />

self keyDownAt: 8.5 beats duration: 0.5 beats frequency: 4 e.<br />

(and so on…)<br />

<strong>The</strong> first line of this script in<strong>for</strong>ms <strong>Kyma</strong> of the metronome that should be used to define the beat <strong>for</strong> the<br />

rest of the script. <strong>The</strong> remaining lines are a transcription of each note from the piece.<br />

Modulo Arithmetic<br />

<strong>The</strong> script of a MIDIVoice or MIDIMapper is actually a program written in Smalltalk; this means that you<br />

can generate events according to an algorithm. <strong>The</strong> script in Kurt’s new rhythm method illustrates the use<br />

of modulo arithmetic in an algorithm that creates a kind of twisted drum machine.<br />

In this script, a subset of seven different fixed-duration fixed-frequency events is algorithmically selected<br />

<strong>for</strong> scheduling on each beat. <strong>The</strong> following is an outline of the script:<br />

MM := 300.<br />

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

(a series of omitted event selection decisions)<br />

].<br />

<strong>The</strong> first line of the script sets the metronome. <strong>The</strong> rest of the script is a loop that counts the variable i up<br />

from 0 to 200. Inside the loop, a series of decisions are made to determine whether each of the seven possible<br />

events should be scheduled <strong>for</strong> this beat.<br />

<strong>The</strong> first of the seven event decisions is:<br />

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

136

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

Saved successfully!

Ooh no, something went wrong!