pyFDN.graphicEQ package#

Submodules#

pyFDN.graphicEQ.absorption_geq module#

Absorption filter design via graphic EQ for FDN delay lines.

Translation of absorptionGEQ.m from fdnToolbox.

Reference:

Schlecht and Habets, “Accurate reverberation time control in feedback delay networks,” Proc. DAFx, 2017.

pyFDN.graphicEQ.absorption_geq.absorption_geq(rt, delays, fs)[source]#

Design per-delay GEQ absorption filters matching target reverberation times.

Each delay line gets its own cascade of biquad sections whose combined attenuation per round trip matches the desired RT at each frequency band.

Parameters:
  • rt (ndarray) – Target reverberation time in seconds at 10 frequency bands, shape (10,) or broadcastable.

  • delays (ndarray) – Delay lengths in samples, shape (num_delays,).

  • fs (float) – Sampling frequency in Hz.

Return type:

ndarray

Returns:

Per-channel SOS bank of shape (num_bands, 6, num_delays) (the canonical SOS bank layout) where num_bands = 11 (flat + low-shelf + 8 bandpass + high-shelf). All sections are normalised so a[0] = 1.

pyFDN.graphicEQ.bandpass_filter module#

Peaking bandpass filter design for graphic EQ.

Translation of bandpassFilter.m from fdnToolbox. Equation (29) in Välimäki and Reiss, “All About Audio Equalization: Solutions and Frontiers,” Applied Sciences, vol. 6, no. 5, p. 129, 2016.

pyFDN.graphicEQ.bandpass_filter.bandpass_filter(omega_c, gain, Q)[source]#

Design a peaking bandpass biquad filter.

Parameters:
  • omega_c (float) – Center frequency in radians.

  • gain (float) – Linear gain at center frequency.

  • Q (float) – Quality factor.

Return type:

tuple[ndarray, ndarray]

Returns:

(b, a) — numerator and denominator coefficients of length 3.

pyFDN.graphicEQ.design_geq module#

10-band graphic EQ design via constrained least squares.

Translation of designGEQ.m from fdnToolbox.

Reference:

Välimäki and Reiss, “All About Audio Equalization: Solutions and Frontiers,” Applied Sciences, vol. 6, no. 5, p. 129, 2016.

pyFDN.graphicEQ.design_geq.design_geq(target_g, fs=48000.0)[source]#

Design a 10-band graphic EQ matching a target magnitude response.

The EQ has 8 peaking bandpass bands plus low and high shelving filters, plus a flat-gain section (11 sections total).

Parameters:
  • target_g (ndarray) – Target magnitude response in dB at 10 frequency bands (DC=1 Hz, 63, 125, 250, 500, 1k, 2k, 4k, 8k Hz, Nyquist). Shape (10,).

  • fs (float) – Sampling frequency in Hz (default 48000).

Return type:

tuple[ndarray, ndarray]

Returns:

(sos, target_f) where

  • sos — single SOS cascade of shape (n_sections, 6) (n_sections = 11).

  • target_f — 10-point frequency grid used for the target.

pyFDN.graphicEQ.graphic_eq module#

Proportional parametric graphic equalizer.

Translation of graphicEQ.m from fdnToolbox.

References

Välimäki and Reiss, “All About Audio Equalization: Solutions and Frontiers,” Applied Sciences, vol. 6, no. 5, p. 129, 2016.

Jot, “Proportional Parametric Equalizers - Application to Digital Reverberation and Environmental Audio Processing,” AES Conv. 2015.

pyFDN.graphicEQ.graphic_eq.graphic_eq(center_omega, shelving_omega, R, gain_db)[source]#

Build a graphic EQ as a bank of independent biquad sections.

Band layout (total len(center_omega) + len(shelving_omega) + 1 sections):

  • Band 0: flat gain section.

  • Band 1: low shelving filter.

  • Bands 2 … N-2: peaking bandpass filters.

  • Band N-1: high shelving filter.

Parameters:
  • center_omega (ndarray) – Center frequencies of bandpass bands in radians, shape (num_center,).

  • shelving_omega (ndarray) – Cut-off frequencies of shelving bands in radians, shape (2,)[low_crossover, high_crossover].

  • R (float) – Bandwidth parameter; quality factor is sqrt(R) / (R - 1).

  • gain_db (ndarray) – Command gains in dB for each section, shape (num_center + 3,) (flat + low shelf + bandpass + high shelf).

Return type:

ndarray

Returns:

SOS matrix of shape (num_bands, 6) with columns [b0, b1, b2, a0, a1, a2].

pyFDN.graphicEQ.probe_sos module#

Frequency response probing of a cascade of biquad sections.

Translation of probeSOS.m from fdnToolbox.

pyFDN.graphicEQ.probe_sos.probe_sos(sos, control_frequencies=None, fft_len=4096, fs=48000.0)[source]#

Evaluate the magnitude response of each biquad at control frequencies.

Parameters:
  • sos (ndarray) – Filter matrix of shape (num_bands, 6) with columns [b0, b1, b2, a0, a1, a2] (rows are independent sections).

  • control_frequencies (ndarray | None) – Frequencies in Hz at which to evaluate.

  • fft_len (int) – FFT length for the frequency response computation.

  • fs (float) – Sampling frequency in Hz.

Return type:

tuple[ndarray, ndarray, ndarray]

Returns:

(G, H, W) where

  • G — magnitude in dB, shape (len(control_frequencies), num_bands).

  • H — complex frequency response, shape (fft_len, num_bands).

  • W — frequency axis in Hz, shape (fft_len, num_bands).

pyFDN.graphicEQ.shelving_filter module#

Shelving filter design for graphic EQ.

Translation of shelvingFilter.m from fdnToolbox. Equations (18) and (20) in Välimäki and Reiss, “All About Audio Equalization: Solutions and Frontiers,” Applied Sciences, vol. 6, no. 5, p. 129, 2016.

pyFDN.graphicEQ.shelving_filter.shelving_filter(omega_c, gain, filter_type)[source]#

Design a shelving biquad filter.

Parameters:
  • omega_c (float) – Cut-off frequency in radians.

  • gain (float) – Linear gain (not dB).

  • filter_type (str) – "low" for low-shelf, "high" for high-shelf.

Return type:

tuple[ndarray, ndarray]

Returns:

(b, a) — numerator and denominator coefficients of length 3.

Module contents#

Graphic equalizer design for FDN absorption filters.

pyFDN.graphicEQ.absorption_geq(rt, delays, fs)[source]#

Design per-delay GEQ absorption filters matching target reverberation times.

Each delay line gets its own cascade of biquad sections whose combined attenuation per round trip matches the desired RT at each frequency band.

Parameters:
  • rt (ndarray) – Target reverberation time in seconds at 10 frequency bands, shape (10,) or broadcastable.

  • delays (ndarray) – Delay lengths in samples, shape (num_delays,).

  • fs (float) – Sampling frequency in Hz.

Return type:

ndarray

Returns:

Per-channel SOS bank of shape (num_bands, 6, num_delays) (the canonical SOS bank layout) where num_bands = 11 (flat + low-shelf + 8 bandpass + high-shelf). All sections are normalised so a[0] = 1.

pyFDN.graphicEQ.bandpass_filter(omega_c, gain, Q)[source]#

Design a peaking bandpass biquad filter.

Parameters:
  • omega_c (float) – Center frequency in radians.

  • gain (float) – Linear gain at center frequency.

  • Q (float) – Quality factor.

Return type:

tuple[ndarray, ndarray]

Returns:

(b, a) — numerator and denominator coefficients of length 3.

pyFDN.graphicEQ.design_geq(target_g, fs=48000.0)[source]#

Design a 10-band graphic EQ matching a target magnitude response.

The EQ has 8 peaking bandpass bands plus low and high shelving filters, plus a flat-gain section (11 sections total).

Parameters:
  • target_g (ndarray) – Target magnitude response in dB at 10 frequency bands (DC=1 Hz, 63, 125, 250, 500, 1k, 2k, 4k, 8k Hz, Nyquist). Shape (10,).

  • fs (float) – Sampling frequency in Hz (default 48000).

Return type:

tuple[ndarray, ndarray]

Returns:

(sos, target_f) where

  • sos — single SOS cascade of shape (n_sections, 6) (n_sections = 11).

  • target_f — 10-point frequency grid used for the target.

pyFDN.graphicEQ.graphic_eq(center_omega, shelving_omega, R, gain_db)[source]#

Build a graphic EQ as a bank of independent biquad sections.

Band layout (total len(center_omega) + len(shelving_omega) + 1 sections):

  • Band 0: flat gain section.

  • Band 1: low shelving filter.

  • Bands 2 … N-2: peaking bandpass filters.

  • Band N-1: high shelving filter.

Parameters:
  • center_omega (ndarray) – Center frequencies of bandpass bands in radians, shape (num_center,).

  • shelving_omega (ndarray) – Cut-off frequencies of shelving bands in radians, shape (2,)[low_crossover, high_crossover].

  • R (float) – Bandwidth parameter; quality factor is sqrt(R) / (R - 1).

  • gain_db (ndarray) – Command gains in dB for each section, shape (num_center + 3,) (flat + low shelf + bandpass + high shelf).

Return type:

ndarray

Returns:

SOS matrix of shape (num_bands, 6) with columns [b0, b1, b2, a0, a1, a2].

pyFDN.graphicEQ.probe_sos(sos, control_frequencies=None, fft_len=4096, fs=48000.0)[source]#

Evaluate the magnitude response of each biquad at control frequencies.

Parameters:
  • sos (ndarray) – Filter matrix of shape (num_bands, 6) with columns [b0, b1, b2, a0, a1, a2] (rows are independent sections).

  • control_frequencies (ndarray | None) – Frequencies in Hz at which to evaluate.

  • fft_len (int) – FFT length for the frequency response computation.

  • fs (float) – Sampling frequency in Hz.

Return type:

tuple[ndarray, ndarray, ndarray]

Returns:

(G, H, W) where

  • G — magnitude in dB, shape (len(control_frequencies), num_bands).

  • H — complex frequency response, shape (fft_len, num_bands).

  • W — frequency axis in Hz, shape (fft_len, num_bands).

pyFDN.graphicEQ.shelving_filter(omega_c, gain, filter_type)[source]#

Design a shelving biquad filter.

Parameters:
  • omega_c (float) – Cut-off frequency in radians.

  • gain (float) – Linear gain (not dB).

  • filter_type (str) – "low" for low-shelf, "high" for high-shelf.

Return type:

tuple[ndarray, ndarray]

Returns:

(b, a) — numerator and denominator coefficients of length 3.