File tree Expand file tree Collapse file tree 4 files changed +534
-459
lines changed
examples/tests/fft/fft-ifft Expand file tree Collapse file tree 4 files changed +534
-459
lines changed Original file line number Diff line number Diff line change @@ -8,28 +8,13 @@ BufferedWindow buffered(&hann);
88SineWaveGenerator<int16_t > sineWave (32000 );
99GeneratedSoundStream<int16_t > in (sineWave);
1010StreamCopy copier (fft, in);
11- CsvStream <int16_t > out (Serial);
12- StreamCopy copierOut (out, fft);
11+ CsvOutput <int16_t > out (Serial);
12+ StreamCopy copierIFFT (out, fft);
1313float value = 0 ;
1414
1515// display fft result
1616void fftResult (AudioFFTBase &fft) {
17- float diff;
18- auto result = fft.result ();
19- if (result.magnitude > 100 ) {
20- Serial.print (result.frequency );
21- Serial.print (" " );
22- Serial.print (result.magnitude );
23- Serial.print (" => " );
24- Serial.print (result.frequencyAsNote (diff));
25- Serial.print (" diff: " );
26- Serial.print (diff);
27- Serial.print (" - time ms " );
28- Serial.print (fft.resultTime () - fft.resultTimeBegin ());
29- Serial.println ();
30- }
31- // execute ifft
32- copierOut.copyAll ();
17+ copierIFFT.copyAll ();
3318}
3419
3520void setup () {
@@ -47,6 +32,9 @@ void setup() {
4732 // Setup FFT
4833 auto tcfg = fft.defaultConfig (RXTX_MODE);
4934 tcfg.window_function = &buffered;
35+ tcfg.length = 1024 ;
36+ tcfg.stride = 512 ;
37+ tcfg.callback = fftResult;
5038 fft.begin (tcfg);
5139
5240 // setup output
You can’t perform that action at this time.
0 commit comments