File: fft2.ck

package info (click to toggle)
chuck 1.5.5.7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 41,260 kB
  • sloc: cpp: 124,539; ansic: 35,893; javascript: 2,111; yacc: 609; makefile: 457; python: 174; perl: 86
file content (31 lines) | stat: -rw-r--r-- 574 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// fft2.ck: yet another way to FFT, by getting array out of blob
// author: Rebecca Fiebrink and Ge Wang

// our patch
SinOsc g => FFT fft => blackhole;

// set srate
second / samp => float srate;
// set parameters
8 => fft.size;

// divide
int div;
// array ref
complex c[];

// control loop
while( true )
{
    // set freq
    srate / fft.size() * div++ => g.freq;
    fft.size()/2 %=> div;
    
    // take fft
    fft.upchuck().cvals() @=> c;
    // examine contents
    <<< c[0]$polar, c[1]$polar, c[2]$polar, c[3]$polar >>>;

    // advance time
    100::ms => now;
}