- 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
28 lines
561 B
C++
28 lines
561 B
C++
#pragma once
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <complex>
|
|
|
|
struct Peak {
|
|
size_t bin;
|
|
float freq;
|
|
float magnitude;
|
|
float reduction;
|
|
};
|
|
|
|
class Detector {
|
|
public:
|
|
Detector();
|
|
void setParams(float sharpness, float selectivity, float depth);
|
|
size_t detectPeaks(const std::complex<double>* spectrum, size_t n,
|
|
float sample_rate, Peak* peaks, size_t max_peaks);
|
|
|
|
private:
|
|
float sharpness_;
|
|
float selectivity_;
|
|
float depth_;
|
|
|
|
float computeReduction(float magnitude, float freq);
|
|
};
|
|
|