*** empty log message ***
[chuck-blob.git] / v2 / examples / otf_03.ck
blobb47aa8a055718c1d18074d38eaa127b0449fc2cd
1  //----------------------------|
2 // on-the-fly synchronization
3 // adapted from Perry's ChucK Drummin' + Ge's sine poops
4 //
5 // authors: Perry Cook (prc@cs.princeton.edu)
6 //          Ge Wang (gewang@cs.princeton.edu)
7 // --------------------|          
8 // add one by one into VM (in pretty much any order):
9 // 
10 // terminal-1%> chuck --loop
11 // ---
12 // terminal-2%> chuck + otf_01.ck
13 // (anytime later)
14 // terminal-2%> chuck + otf_02.ck
15 // (etc...)
16 //--------------------------------------|
18 // this synchronizes to period
19 .5::second => dur T;
20 T - (now % T) => now;
22 // extra half T offset
23 .5::T => now;
25 // construct the patch
26 SndBuf buf => Gain g => dac;
27 "data/hihat-open.wav" => buf.read;
28 .5 => g.gain;
30 // time loop
31 while( true )
33     0 => buf.pos;
34     Std.rand2f(.8,.9) => buf.gain;
35     1::T => now;