File: array.ck

package info (click to toggle)
chuck 1.5.5.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 41,056 kB
  • sloc: cpp: 123,473; ansic: 35,893; javascript: 2,111; yacc: 609; makefile: 457; python: 174; perl: 86
file content (40 lines) | stat: -rw-r--r-- 842 bytes parent folder | download | duplicates (3)
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
// dope storm
// using arrays as UGen busses
// author: Spencer Salazar - spencer@ccrma.stanford.edu
// date: May 2013

// patch mixing arrays of mono and stereo UGens
SndBuf buf[32] => Pan2 pan[32] => NRev reverb[2] => dac;

// set reverb mix
0.1 => reverb[0].mix;
0.11 => reverb[1].mix;

// load sound
for( int i; i < buf.size(); i++ )
{
    // load dope sound
    "special:dope" => buf[i].read;
    // set to end
    buf[i].samples() => buf[i].pos;
}

// index
0 => int i;

while(true)
{
    // randomize pan
    Math.random2f(-0.5,0.5) => pan[i%pan.size()].pan;
    // Math.pow(2, Math.random2f(-1.5, 1.5)) => buf[i%buf.size()].rate;

    // reset playback position for a buf
    0 => buf[i%buf.size()].pos;

    // randomize time
    Math.random2f(0.075, 0.125)::second => now;
    //0.5::second => now;

    // increment    
    i++;
}