Skip to content

Commit 4abc666

Browse files
committed
FFT: RFFT overlap add DRAFT
1 parent d40c82e commit 4abc666

File tree

4 files changed

+534
-459
lines changed

4 files changed

+534
-459
lines changed

examples/tests/fft/fft-ifft/fft-ifft.ino

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,13 @@ BufferedWindow buffered(&hann);
88
SineWaveGenerator<int16_t> sineWave(32000);
99
GeneratedSoundStream<int16_t> in(sineWave);
1010
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);
1313
float value = 0;
1414

1515
// display fft result
1616
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();
3318
}
3419

3520
void 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

0 commit comments

Comments
 (0)