| 1 |
// fft3.ck: yet another way to get FFT spectrum - without blobs |
| 2 |
// authors: Rebecca Fiebrink and Ge Wang |
| 3 |
|
| 4 |
// our patch |
| 5 |
SinOsc g => FFT fft => blackhole; |
| 6 |
// set srate |
| 7 |
second / samp => float srate; |
| 8 |
|
| 9 |
// set parameters |
| 10 |
8 => fft.size; |
| 11 |
|
| 12 |
// use this to hold contents |
| 13 |
complex s[fft.size()/2]; |
| 14 |
// divide |
| 15 |
int div; |
| 16 |
|
| 17 |
// control loop |
| 18 |
while( true ) |
| 19 |
{ |
| 20 |
// set freq |
| 21 |
srate / fft.size() * div++ => g.freq; |
| 22 |
fft.size()/2 %=> div; |
| 23 |
|
| 24 |
// take fft |
| 25 |
fft.upchuck(); |
| 26 |
// get contents |
| 27 |
fft.spectrum( s ); |
| 28 |
// examine contents |
| 29 |
<<< s[0]$polar, s[1]$polar, s[2]$polar, s[3]$polar >>>; |
| 30 |
|
| 31 |
// advance time |
| 32 |
100::ms => now; |
| 33 |
} |