| 1 |
// dct.ck: taking DCT via upchuck, printing the spectrum |
| 2 |
// authors: Rebecca Fiebrink and Ge Wang |
| 3 |
|
| 4 |
// our patch |
| 5 |
SinOsc g => DCT dct => blackhole; |
| 6 |
|
| 7 |
// set srate |
| 8 |
second / samp => float srate; |
| 9 |
// set parameters |
| 10 |
8 => dct.size; |
| 11 |
// divide |
| 12 |
int div; |
| 13 |
|
| 14 |
// control loop |
| 15 |
while( true ) |
| 16 |
{ |
| 17 |
// set freq |
| 18 |
srate / dct.size() * div++ => g.freq; |
| 19 |
dct.size()/2 %=> div; |
| 20 |
|
| 21 |
// take dct |
| 22 |
dct.upchuck(); |
| 23 |
// examine contents |
| 24 |
<<< dct.fval(0), dct.fval(1), dct.fval(2), dct.fval(3) >>>; |
| 25 |
|
| 26 |
// advance time |
| 27 |
100::ms => now; |
| 28 |
} |