| 1 |
// fft2.ck: yet another way to FFT, by getting array out of blob |
| 2 |
// author: 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 |
|
| 12 |
// divide |
| 13 |
int div; |
| 14 |
// array ref |
| 15 |
complex c[]; |
| 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().cvals() @=> c; |
| 26 |
// examine contents |
| 27 |
<<< c[0]$polar, c[1]$polar, c[2]$polar, c[3]$polar >>>; |
| 28 |
|
| 29 |
// advance time |
| 30 |
100::ms => now; |
| 31 |
} |