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);
8
8
SineWaveGenerator<int16_t > sineWave (32000 );
9
9
GeneratedSoundStream<int16_t > in (sineWave);
10
10
StreamCopy 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);
13
13
float value = 0 ;
14
14
15
15
// display fft result
16
16
void 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 ();
33
18
}
34
19
35
20
void setup () {
@@ -47,6 +32,9 @@ void setup() {
47
32
// Setup FFT
48
33
auto tcfg = fft.defaultConfig (RXTX_MODE);
49
34
tcfg.window_function = &buffered;
35
+ tcfg.length = 1024 ;
36
+ tcfg.stride = 512 ;
37
+ tcfg.callback = fftResult;
50
38
fft.begin (tcfg);
51
39
52
40
// setup output
You can’t perform that action at this time.
0 commit comments