// Random things you probably don't want to do // SndBuf bob => blackhole; // "HomerDoh.wav" => bob.read; // int i; // float table[bob.samps()]; // while (bob.pos() < bob.samps()) { // bob.last() => table[i++]; // 1 :: samp => now; // } float table[442]; for (0 => int i; i < 442; i++) { // Math.sin(6.24*i/441) => table[i]; // Load sine wave // i / 440.1 => table[i]; // or sawtooth // if (i < 220) i / 220.0 => table[i]; // or triangle up // else (441-i) / 220.0 => table[i]; // and triangle down Std.rand2f(-1.0,1.0) => table[i]; } Impulse imp => dac; // so we can write to the dac directly 0 => int i; while (1) { 1 :: samp => now; table[i] => imp.next; 0.99*(table[i]+table[(i+1) % 441])/2.0 => table[i]; 1 +=> i; if (i >= 441) 0 => i; }