// src/Processor.h #pragma once #include #include #include #include class Processor { public: Processor(int frameSize, int sampleRate); ~Processor(); void setFrameSize(int size); void setSampleRate(int rate); void setNumBins(int n); // DSP Effects void setSmoothing(int historyLength); void setExpander(float ratio, float thresholdDb); void setHPF(float cutoffFreq); // Cepstral Smoothing (Trig Interpolation) void setCepstralParams(int granularity, int detail, float strength); // Input is now double precision complex void pushData(const std::vector>& data); struct Spectrum { std::vector freqs; std::vector db; std::vector cepstrum; // raw cepstral coefficients (positive quefrencies) }; Spectrum getSpectrum(); private: int m_frameSize; int m_sampleRate; // FFTW Resources for Main Spectrum (Double Precision) fftw_complex* m_in; fftw_complex* m_out; fftw_plan m_plan; std::vector m_window; // FFTW Resources for Cepstral Smoothing (Double Precision) fftw_complex* m_cep_in; fftw_complex* m_cep_out; fftw_plan m_cep_plan_fwd; fftw_plan m_cep_plan_inv; // Buffer for the current audio frame std::vector> m_buffer; // Mapping & Smoothing std::vector m_customBins; std::vector m_freqsConst; // Moving Average History std::deque> m_history; size_t m_smoothingLength = 3; // Expander Settings float m_expandRatio = 1.0f; float m_expandThreshold = -60.0f; // HPF Settings float m_hpfCutoff = 0.0f; // Cepstral Settings int m_granularity = 33; int m_detail = 50; float m_cepstralStrength = 0.0f; double getInterpolatedDb(const std::vector& freqs, const std::vector& db, double targetFreq); // Internal helper for the Trig Interpolation logic std::vector idealizeCurve(const std::vector& magSpectrum); };