- 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
43 lines
740 B
C++
43 lines
740 B
C++
#pragma once
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <cstring>
|
|
|
|
constexpr size_t MAX_BANDS = 8;
|
|
|
|
struct FilterParams {
|
|
float freq;
|
|
float q;
|
|
float gain;
|
|
int type;
|
|
int on;
|
|
};
|
|
|
|
struct FilterState {
|
|
float x1, x2, y1, y2;
|
|
};
|
|
|
|
class DigitalFilter {
|
|
public:
|
|
DigitalFilter();
|
|
void setParams(const FilterParams& p, float sample_rate);
|
|
float process(float x);
|
|
|
|
private:
|
|
FilterParams params_;
|
|
FilterState state_;
|
|
float b0, b1, b2, a1, a2;
|
|
float fs_;
|
|
|
|
void updateCoeffs();
|
|
};
|
|
|
|
class FilterGraph {
|
|
public:
|
|
FilterGraph();
|
|
void processBlock(float* in, float* out, size_t n, const FilterParams* bands, size_t num_bands);
|
|
|
|
private:
|
|
DigitalFilter filters_[MAX_BANDS];
|
|
};
|