This commit is contained in:
2025-07-31 16:27:44 +03:00
parent 35c09187a4
commit aa949ba2a7
3 changed files with 52 additions and 88 deletions

View File

@ -3,5 +3,16 @@
#include <math.h>
#define FFT_SIZE 2048
void init_hamming_window();
void compute_fft(float* time_data, float* freq_out);
// Simple complex number struct
struct Complex {
float re, im;
Complex(float r = 0, float i = 0) : re(r), im(i) {}
Complex operator+(const Complex& o) const { return { re + o.re, im + o.im }; }
Complex operator-(const Complex& o) const { return { re - o.re, im - o.im }; }
Complex operator*(const Complex& o) const {
return { re * o.re - im * o.im, re * o.im + im * o.re };
}
};
void fft(Complex* x, int N, Complex* buffer);