-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlivecode.ck
More file actions
46 lines (39 loc) · 1.09 KB
/
livecode.ck
File metadata and controls
46 lines (39 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// STK Clarinet
// (also see examples/event/polyfony2.ck)
// patch
Clarinet clair => JCRev r => dac;
.75 => r.gain;
.1 => r.mix;
// our notes
[ 61, 63, 65, 66, 68, 66, 65, 63, 61 ] @=> int notes[];
// infinite time-loop
while( true )
{
// clear
clair.clear( 1.0 );
// set
Math.random2f( 0, 1 ) => clair.reed;
Math.random2f( 0, 1 ) => clair.noiseGain;
Math.random2f( 0, 12 ) => clair.vibratoFreq;
Math.random2f( 0, 1 ) => clair.vibratoGain;
Math.random2f( 0, 1 ) => clair.pressure;
// print
<<< "---", "" >>>;
<<< "reed stiffness:", clair.reed() >>>;
<<< "noise gain:", clair.noiseGain() >>>;
<<< "vibrato freq:", clair.vibratoFreq() >>>;
<<< "vibrato gain:", clair.vibratoGain() >>>;
<<< "breath pressure:", clair.pressure() >>>;
for( int i; i < notes.cap(); i++ )
{
play( 12 + notes[i], Math.random2f( .6, .9 ) );
300::ms => now;
}
}
// basic play function (add more arguments as needed)
fun void play( float note, float velocity )
{
// start the note
Std.mtof( note ) => clair.freq;
velocity => clair.noteOn;
}