// Fast Fourier Transform (FFT) implementation // Radix-2 Cooley-Tukey algorithm for power-of-2 sizes // This implementation matches the JavaScript version in tools/spectral_editor/dct.js #ifndef AUDIO_FFT_H_ #define AUDIO_FFT_H_ #include // Forward FFT: Time domain → Frequency domain // Input: real[] (length N), imag[] (length N, can be zeros) // Output: real[] and imag[] contain complex frequency bins // N must be a power of 2 void fft_forward(float* real, float* imag, size_t N); // Inverse FFT: Frequency domain → Time domain // Input: real[] (length N), imag[] (length N) // Output: real[] and imag[] contain complex time samples (scaled by 1/N) // N must be a power of 2 void fft_inverse(float* real, float* imag, size_t N); // DCT Type-II via FFT (matches existing dct_512 signature) // Input: input[] (length N) // Output: output[] (length N) containing DCT-II coefficients // N must be a power of 2 void dct_fft(const float* input, float* output, size_t N); // IDCT (Inverse DCT Type-II) via FFT (matches existing idct_512 signature) // Input: input[] (length N) // Output: output[] (length N) containing time-domain samples // N must be a power of 2 void idct_fft(const float* input, float* output, size_t N); #endif /* AUDIO_FFT_H_ */