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