*** empty log message ***
[chuck-blob.git] / v2 / examples / stk / voic-o-form.ck
blob8025188bbe754f66f5ca63bf8224601ed3af02b8
1 // music for replicants
3 // patch
4 VoicForm voc=> JCRev r => Echo a => Echo b => Echo c => dac;
6 // settings
7 220.0 => voc.freq;
8 0.95 => voc.gain;
9 .8 => r.gain;
10 .2 => r.mix;
11 1000::ms => a.max => b.max => c.max;
12 750::ms => a.delay => b.delay => c.delay;
13 .50 => a.mix => b.mix => c.mix;
15 // shred to modulate the mix
16 fun void vecho_Shred( )
18     0.0 => float decider;
19     0.0 => float mix;
20     0.0 => float old;
21     0.0 => float inc;
22     0 => int n;
24     // time loop
25     while( true )
26     {
27         Std.rand2f(0.0,1.0) => decider;
28         if( decider < .3 ) 0.0 => mix;
29         else if( decider < .6 ) .08 => mix;
30         else if( decider < .8 ) .5 => mix;
31         else .15 => mix;
33         // find the increment
34         (mix-old)/1000.0 => inc;
35         1000 => n;
36         while( n-- )
37         {
38             old + inc => old;
39             old => a.mix => b.mix => c.mix;
40             1::ms => now;
41         }
42         mix => old;
43         Std.rand2(2,6)::second => now;
44     }
47 // let echo shred go
48 spork ~ vecho_Shred();
49 0.5 => voc.loudness;
50 0.01 => voc.vibratoGain;
52 // scale
53 [ 0, 2, 4, 7, 9 ] @=> int scale[];
55 // our main time loop
56 while( true )
58     2 * Std.rand2( 0,2 ) => int bphon;
59     bphon => voc.phonemeNum;
60     Std.rand2f( 0.6, 0.8 ) => voc.noteOn;
62     if( Std.randf() > 0.7 )
63     { 1000::ms => now; }
64     else if( Std.randf() > .7 )
65     { 500::ms => now; }
66     else if( Std.randf() > -0.8 )
67     { .250::second => now; }
68     else
69     {
70         0 => int i;
71         4 * Std.rand2( 1, 4 ) => int pick;
72         0 => int pick_dir;
73         0.0 => float pluck;
75         for( ; i < pick; i++ )
76         {
77             bphon + 1 * pick_dir => voc.phonemeNum;
78             Std.rand2f(.4,.6) + i*.035 => pluck;
79             pluck + 0.0 * pick_dir => voc.noteOn;
80             !pick_dir => pick_dir;
81             250::ms => now;
82         }
83     }
85     // pentatonic
86     scale[Std.rand2(0,scale.cap()-1)] => int freq;
87     Std.mtof( ( 45 + Std.rand2(0,2) * 12 + freq ) ) => voc.freq;