Skip to content

biquad


biquad_section class

template <typename T> biquad_section

Structure for holding biquad filter coefficients.


biquad_state class

template <typename T, size_t filters> biquad_state

iir_params class

template <typename T, size_t filters = tag_dynamic_vector>
iir_params

template <typename T> iir_params

iir_state class

template <typename T, size_t filters> iir_state

expression_iir_l class (generic::expression_iir_l)

template <size_t filters, typename T, typename E1,
          bool Stateless = false>
expression_iir_l

expression_iir class (generic::expression_iir)

template <size_t filters, typename T, typename E1,
          bool Stateless = false>
expression_iir

iir function (generic::iir)

template <size_t filters, typename T, typename E1>
expression_iir<filters, T, E1>
iir(E1 &&e1, iir_params<T, filters> params)

Returns template expressions that applies biquad filter to the input.
Param e1 Input expression
Param params Biquad coefficients


template <typename T, typename E1>
expression_handle<T, 1>
iir(E1 &&e1,
    const iir_params<T, tag_dynamic_vector> &params)

Returns template expressions that applies biquad filter to the input.
Param e1 Input expression
Param params Biquad coefficients


template <size_t filters, typename T, typename E1>
expression_iir<filters, T, E1, true>
iir(E1 &&e1,
    std::reference_wrapper<iir_state<T, filters>> state)

Returns template expressions that applies biquad filter to the input.
Param bq Biquad coefficients
Param e1 Input expression


filtfilt function (generic::filtfilt)

template <typename T, univector_tag Tag, size_t Itag>
void filtfilt(univector<T, Tag> &arr,
              const iir_params<T, Itag> &params)

Applies forward and backward filtering to the input array using the given IIR filter parameters.

This function performs zero-phase filtering by first applying the IIR filter in the forward direction and then applying it again in the reverse direction. The result is a filtered signal with minimal phase distortion.
Template param T The data type of the elements in the input array.
Template param Tag The tag type associated with the input array.
Template param Itag The tag type associated with the IIR filter parameters.
Param arr The input array to be filtered. This array is modified in-place to store the filtered result.
Param params The IIR filter parameters used for filtering the input array.


iir_filter class

template <typename T> iir_filter

biquad_allpass function (generic::biquad_allpass)

template <typename T = fbase>
biquad_section<T>
biquad_allpass(std::type_identity_t<T> frequency,
               std::type_identity_t<T> Q)

Calculates coefficients for the all-pass biquad filter
Param frequency Normalized frequency (frequency_Hz / samplerate_Hz)
Param Q Q factor
Returns Biquad filter coefficients


biquad_lowpass function (generic::biquad_lowpass)

template <typename T = fbase>
biquad_section<T>
biquad_lowpass(std::type_identity_t<T> frequency,
               std::type_identity_t<T> Q)

Calculates coefficients for the low-pass biquad filter
Param frequency Normalized frequency (frequency_Hz / samplerate_Hz)
Param Q Q factor
Returns Biquad filter coefficients


biquad_highpass function (generic::biquad_highpass)

template <typename T = fbase>
biquad_section<T>
biquad_highpass(std::type_identity_t<T> frequency,
                std::type_identity_t<T> Q)

Calculates coefficients for the high-pass biquad filter
Param frequency Normalized frequency (frequency_Hz / samplerate_Hz)
Param Q Q factor
Returns Biquad filter coefficients


biquad_bandpass function (generic::biquad_bandpass)

template <typename T = fbase>
biquad_section<T>
biquad_bandpass(std::type_identity_t<T> frequency,
                std::type_identity_t<T> Q)

Calculates coefficients for the band-pass biquad filter
Param frequency Normalized frequency (frequency_Hz / samplerate_Hz)
Param Q Q factor
Returns Biquad filter coefficients


biquad_notch function (generic::biquad_notch)

template <typename T = fbase>
biquad_section<T>
biquad_notch(std::type_identity_t<T> frequency,
             std::type_identity_t<T> Q)

Calculates coefficients for the notch biquad filter
Param frequency Normalized frequency (frequency_Hz / samplerate_Hz)
Param Q Q factor
Returns Biquad filter coefficients


biquad_peak function (generic::biquad_peak)

template <typename T = fbase>
biquad_section<T>
biquad_peak(std::type_identity_t<T> frequency,
            std::type_identity_t<T> Q,
            std::type_identity_t<T> gain)

Calculates coefficients for the peak biquad filter
Param frequency Normalized frequency (frequency_Hz / samplerate_Hz)
Param Q Q factor
Param gain Gain in dB
Returns Biquad filter coefficients


biquad_lowshelf function (generic::biquad_lowshelf)

template <typename T = fbase>
biquad_section<T>
biquad_lowshelf(std::type_identity_t<T> frequency,
                std::type_identity_t<T> gain)

Calculates coefficients for the low-shelf biquad filter
Param frequency Normalized frequency (frequency_Hz / samplerate_Hz)
Param gain Gain in dB
Returns Biquad filter coefficients


biquad_highshelf function (generic::biquad_highshelf)

template <typename T = fbase>
biquad_section<T>
biquad_highshelf(std::type_identity_t<T> frequency,
                 std::type_identity_t<T> gain)

Calculates coefficients for the high-shelf biquad filter
Param frequency Normalized frequency (frequency_Hz / samplerate_Hz)
Param gain Gain in dB
Returns Biquad filter coefficients


dcremove function

template <typename E1,
          typename T = flt_type<expression_value_type<E1>>>
expression_iir<1, T, E1> dcremove(E1 &&e1, double cutoff_hz,
                                  double fs_hz)

Applies a DC removal filter to the given input expression.

This function designs a 2nd order Butterworth high-pass filter to remove the DC component from the input signal. The filter is implemented as a single biquad section with a cutoff frequency specified by cutoff_hz.
Template param T The data type used for the filter coefficients.
Template param E1 The type of the input expression.
Param e1 The input expression to be filtered.
Param cutoff_hz The cutoff frequency of the high-pass filter in Hz.
Param fs_hz The sampling frequency of the input signal in Hz.
Returns An expression representing the filtered signal.


Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/