Evaluate what a biquad (or a cascade of them) does to the spectrum. More...
#include <pulp/signal/biquad.hpp>#include <algorithm>#include <cmath>#include <complex>#include <cstddef>#include <span>Go to the source code of this file.
Namespaces | |
| namespace | pulp |
| namespace | pulp::signal |
Functions | |
| float | pulp::signal::magnitude_to_db (double magnitude) |
| Convert a linear magnitude to dB, floored at min_response_db. | |
| template<typename SampleType> | |
| double | pulp::signal::section_magnitude (const BiquadCoefficientsT< SampleType > &c, double omega) |
| Linear magnitude |H(e^jω)| of one section at normalized angular frequency ω = 2π·f/fs (radians/sample, meaningful over [0, π]). | |
| double | pulp::signal::section_magnitude (const BiquadCoefficients &c, double omega) |
| template<typename SampleType> | |
| double | pulp::signal::section_group_delay (const BiquadCoefficientsT< SampleType > &c, double omega) |
| Group delay of one biquad section at omega (radians per sample), in samples: -d(arg H)/d(omega) for H = B/A, evaluated in closed form as tau(B) - tau(A) with tau(P) = Re(sum k p_k z^-k / sum p_k z^-k), so no numeric differentiation is involved. | |
| template<typename SampleType, std::size_t Extent> | |
| double | pulp::signal::cascade_magnitude (std::span< const BiquadCoefficientsT< SampleType >, Extent > sos, double omega) |
| Linear magnitude |H| of a cascade at angular frequency ω. | |
| double | pulp::signal::cascade_magnitude (std::span< const BiquadCoefficients > sos, double omega) |
| double | pulp::signal::angular_frequency (double freq_hz, double sample_rate) |
| Angular frequency (radians/sample) of freq_hz at sample_rate, clamped to [0, π]. | |
| template<typename SampleType> | |
| float | pulp::signal::section_magnitude_db (const BiquadCoefficientsT< SampleType > &c, double freq_hz, double sample_rate) |
| Magnitude of one section at a frequency in Hz, in dB. | |
| float | pulp::signal::section_magnitude_db (const BiquadCoefficients &c, double freq_hz, double sample_rate) |
| template<typename SampleType, std::size_t Extent> | |
| float | pulp::signal::cascade_magnitude_db (std::span< const BiquadCoefficientsT< SampleType >, Extent > sos, double freq_hz, double sample_rate) |
| Magnitude of a cascade at a frequency in Hz, in dB. | |
| float | pulp::signal::cascade_magnitude_db (std::span< const BiquadCoefficients > sos, double freq_hz, double sample_rate) |
| template<typename SampleType> | |
| float | pulp::signal::magnitude_db (const BiquadT< SampleType > &filter, double freq_hz, double sample_rate) |
| Ask a live filter what it looks like: the magnitude, in dB, that this BiquadT is applying at freq_hz with its coefficients as they stand. | |
| double | pulp::signal::fft_bin_frequency (std::size_t index, std::size_t bin_count, double sample_rate) |
| Center frequency of bin index in a real-FFT magnitude array. | |
| double | pulp::signal::log_frequency_at (std::size_t index, std::size_t count, double min_hz, double max_hz) |
| Frequency of sample index of count, log-spaced across [min_hz, max_hz]. | |
| template<typename SampleType, std::size_t Extent> | |
| void | pulp::signal::response_curve_db (std::span< const BiquadCoefficientsT< SampleType >, Extent > sos, double min_hz, double max_hz, double sample_rate, std::span< float > out) |
| Sample a cascade's magnitude response into out, at out.size() log-spaced frequencies spanning [min_hz, max_hz], in dB. | |
| void | pulp::signal::response_curve_db (std::span< const BiquadCoefficients > sos, double min_hz, double max_hz, double sample_rate, std::span< float > out) |
Variables | |
| constexpr float | pulp::signal::min_response_db = -200.0f |
| Floor applied to dB conversions. | |
Evaluate what a biquad (or a cascade of them) does to the spectrum.
This is the analysis half of the biquad story. The design half (filter_design.hpp / iir_design.hpp) turns filter parameters into coefficients; BiquadT runs those coefficients over samples. Neither can answer "what curve does this filter draw?" — that is what lives here.
Every entry point takes the canonical BiquadCoefficientsT from biquad.hpp, preserving its float or double coefficient precision, so the same section that is processing audio right now (via BiquadT::coefficients()) is the one being plotted. A UI never has to re-derive, and therefore never has to approximate, a filter's shape.
RT contract: allocation-free. These are trig-heavy and meant for control-rate / UI use, not the audio callback.