KFR

Biquad/IIR functions

biquad_params

template<typename T>
class biquad_params

Structure for holding biquad filter coefficients.

biquad

template<typename T, typename E1>
internal::expression_biquads<1, T, E1> biquad(const biquad_params<T> &bq, E1 &&e1)

Returns template expressions that applies biquad filter to the input.

Parameters:
  • bq – Biquad coefficients
  • e1 – Input expression

Source:

template <typename T, typename E1>
CMT_INLINE internal::expression_biquads<1, T, E1> biquad(const biquad_params<T>& bq, E1&& e1)

biquad_l

template<size_t filters, typename T, typename E1>
internal::expression_biquads_l<filters, T, E1> biquad_l(const biquad_params<T> (&bq)[filters], E1 &&e1)

Returns template expressions that applies cascade of biquad filters to the input.

Parameters:
  • bq – Array of biquad coefficients
  • e1 – Input expression

Note

This implementation introduces delay of N - 1 samples, where N is the filter count.

Source:

template <size_t filters, typename T, typename E1>
CMT_INLINE internal::expression_biquads_l<filters, T, E1> biquad_l(const biquad_params<T> (&bq)[filters],
                                                                   E1&& e1)

biquad

template<size_t filters, typename T, typename E1>
internal::expression_biquads<filters, T, E1> biquad(const biquad_params<T> (&bq)[filters], E1 &&e1)

Returns template expressions that applies cascade of biquad filters to the input.

Parameters:
  • bq – Array of biquad coefficients
  • e1 – Input expression

Note

This implementation has zero latency

Source:

template <size_t filters, typename T, typename E1>
CMT_INLINE internal::expression_biquads<filters, T, E1> biquad(const biquad_params<T> (&bq)[filters], E1&& e1)
template<typename T, typename E1>
expression_pointer<T> biquad(const biquad_params<T> *bq, size_t count, E1 &&e1)

Returns template expressions that applies cascade of biquad filters to the input.

Parameters:
  • bq – Array of biquad coefficients
  • e1 – Input expression

Note

This implementation has zero latency

Source:

template <typename T, typename E1>
CMT_INLINE expression_pointer<T> biquad(const biquad_params<T>* bq, size_t count, E1&& e1)

biquad_allpass

template<typename T = fbase>
biquad_params<T> biquad_allpass(identity<T> frequency, identity<T> Q)

Calculates coefficients for the all-pass biquad filter

Parameters:
  • frequency – Normalized frequency (frequency_Hz / samplerate_Hz)
  • Q – Q factor
Returns:

Biquad filter coefficients

Source:

template <typename T = fbase>
biquad_params<T> biquad_allpass(identity<T> frequency, identity<T> Q)

biquad_lowpass

template<typename T = fbase>
biquad_params<T> biquad_lowpass(identity<T> frequency, identity<T> Q)

Calculates coefficients for the low-pass biquad filter

Parameters:
  • frequency – Normalized frequency (frequency_Hz / samplerate_Hz)
  • Q – Q factor
Returns:

Biquad filter coefficients

Source:

template <typename T = fbase>
biquad_params<T> biquad_lowpass(identity<T> frequency, identity<T> Q)

biquad_highpass

template<typename T = fbase>
biquad_params<T> biquad_highpass(identity<T> frequency, identity<T> Q)

Calculates coefficients for the high-pass biquad filter

Parameters:
  • frequency – Normalized frequency (frequency_Hz / samplerate_Hz)
  • Q – Q factor
Returns:

Biquad filter coefficients

Source:

template <typename T = fbase>
biquad_params<T> biquad_highpass(identity<T> frequency, identity<T> Q)

biquad_bandpass

template<typename T = fbase>
biquad_params<T> biquad_bandpass(identity<T> frequency, identity<T> Q)

Calculates coefficients for the band-pass biquad filter

Parameters:
  • frequency – Normalized frequency (frequency_Hz / samplerate_Hz)
  • Q – Q factor
Returns:

Biquad filter coefficients

Source:

template <typename T = fbase>
biquad_params<T> biquad_bandpass(identity<T> frequency, identity<T> Q)

biquad_notch

template<typename T = fbase>
biquad_params<T> biquad_notch(identity<T> frequency, identity<T> Q)

Calculates coefficients for the notch biquad filter

Parameters:
  • frequency – Normalized frequency (frequency_Hz / samplerate_Hz)
  • Q – Q factor
Returns:

Biquad filter coefficients

Source:

template <typename T = fbase>
biquad_params<T> biquad_notch(identity<T> frequency, identity<T> Q)

biquad_peak

template<typename T = fbase>
biquad_params<T> biquad_peak(identity<T> frequency, identity<T> Q, identity<T> gain)

Calculates coefficients for the peak biquad filter

Parameters:
  • frequency – Normalized frequency (frequency_Hz / samplerate_Hz)
  • Q – Q factor
  • gain – Gain in dB
Returns:

Biquad filter coefficients

Source:

template <typename T = fbase>
biquad_params<T> biquad_peak(identity<T> frequency, identity<T> Q, identity<T> gain)

biquad_lowshelf

template<typename T = fbase>
biquad_params<T> biquad_lowshelf(identity<T> frequency, identity<T> gain)

Calculates coefficients for the low-shelf biquad filter

Parameters:
  • frequency – Normalized frequency (frequency_Hz / samplerate_Hz)
  • gain – Gain in dB
Returns:

Biquad filter coefficients

Source:

template <typename T = fbase>
biquad_params<T> biquad_lowshelf(identity<T> frequency, identity<T> gain)

biquad_highshelf

template<typename T = fbase>
biquad_params<T> biquad_highshelf(identity<T> frequency, identity<T> gain)

Calculates coefficients for the high-shelf biquad filter

Parameters:
  • frequency – Normalized frequency (frequency_Hz / samplerate_Hz)
  • gain – Gain in dB
Returns:

Biquad filter coefficients

Source:

template <typename T = fbase>
biquad_params<T> biquad_highshelf(identity<T> frequency, identity<T> gain)