/usr/share/doc/chuck/examples/otf_07.ck is in chuck 1.2.0.8.dfsg-1.4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | //----------------------------|
// on-the-fly synchronization
// adapted from Perry's ChucK Drummin' + Ge's sine poops
//
// authors: Perry Cook (prc@cs.princeton.edu)
// Ge Wang (gewang@cs.princeton.edu)
// --------------------|
// add one by one into VM (in pretty much any order):
//
// terminal-1%> chuck --loop
// ---
// terminal-2%> chuck + otf_01.ck
// (anytime later)
// terminal-2%> chuck + otf_02.ck
// (etc...)
//--------------------------------------|
// this synchronizes to period
.5::second => dur T;
T - (now % T) => now;
// construct the patch
SndBuf buf => Gain g => JCRev r => dac;
"data/snare.wav" => buf.read;
.5 => g.gain;
.05 => r.mix;
// where we actually want to start
25 => int where;
// time loop
while( true )
{
Std.rand2f(.8,.9) => buf.gain;
if( Std.randf() > .5 )
{
0 => int i;
while( i < 8 )
{
i / 8.0 => buf.gain;
where => buf.pos;
(1.0/8.0)::T => now;
i++;
}
while( i > 0 )
{
i / 8.0 => buf.gain;
where => buf.pos;
(1.0/8.0)::T => now;
i--;
}
}
else
{
.9 => buf.gain;
where => buf.pos;
.25::T => now;
.3 => buf.gain;
where => buf.pos;
.25::T => now;
.3 => buf.gain;
where => buf.pos;
.25::T => now;
.9 => buf.gain;
where => buf.pos;
.25::T => now;
.3 => buf.gain;
where => buf.pos;
.25::T => now;
.3 => buf.gain;
where => buf.pos;
.25::T => now;
.9 => buf.gain;
where => buf.pos;
.25::T => now;
.3 => buf.gain;
where => buf.pos;
.25::T => now;
}
}
|