dsp/: C++ skeleton with working FFT/WOLA STFT
- Cooley-Tukey radix-2 FFT (forward + inverse with /N normalization) - WOLA STFT/ISTFT with Hann window (nfft=2048, hop=512) - WAV16 read + WAV24 write (fixed aliasing bug in read) - Fixed in-place processing bug (separate input/output buffers) - Biquad filter (peak/shelf/reject) - Peak detector skeleton - MS encode/decode (M8 stereo) - Harness: WAV16 → STFT → WAV24 passthrough verified non-zero output Verified: burst500.wav passthrough produces output RMS=0.0678
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#include "twiddle_builder.hpp"
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
|
||||
namespace twiddle {
|
||||
|
||||
double* build_twiddle(uint32_t log2N, double* dst) {
|
||||
uint32_t N = 1U << log2N;
|
||||
uint32_t N_quarter = N / 4;
|
||||
|
||||
if (log2N < 11) {
|
||||
uint32_t stride = 1U << (10 - log2N);
|
||||
for (uint32_t k = 0; k < N_quarter; k++) {
|
||||
dst[k] = phase_table[k * stride];
|
||||
}
|
||||
} else {
|
||||
double angle_step = (2.0 * M_PI) / N;
|
||||
for (uint32_t k = 0; k < N_quarter; k++) {
|
||||
dst[k] = k * angle_step;
|
||||
}
|
||||
}
|
||||
|
||||
dst[N_quarter] = 1.0;
|
||||
|
||||
uint8_t* p = reinterpret_cast<uint8_t*>(dst);
|
||||
uintptr_t aligned = (reinterpret_cast<uintptr_t>(p + N * 8 + 0x3f) & ~0x3f);
|
||||
return reinterpret_cast<double*>(aligned);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user