pyFDN.eq package#

Submodules#

pyFDN.eq.biquads module#

Biquad coefficient primitives behind the EQ designers (internal).

The functions in this module describe filter sections, not why a filter is being designed: their gains are linear amplitudes and their frequencies in radians per sample. Design filters with the gain_to_* / decay_to_* functions of pyFDN.eq.design, which take dB, seconds and Hz.

pyFDN.eq.biquads.first_order_shelf_biquad(gain_dc, gain_nyquist, omega_c)[source]#

Return a normalized one-section SOS from two linear amplitudes.

Return type:

Any

pyFDN.eq.biquads.highshelf_biquad(omega_c, gain)[source]#

Return (b, a) for a second-order high-shelf section.

Return type:

tuple[Any, Any]

pyFDN.eq.biquads.lowshelf_biquad(omega_c, gain)[source]#

Return (b, a) for a second-order low-shelf section.

Return type:

tuple[Any, Any]

pyFDN.eq.biquads.one_pole_biquad(gain_dc, gain_nyquist)[source]#

Return a normalized one-pole section from two linear amplitudes.

Return type:

Any

pyFDN.eq.biquads.peaking_biquad(omega_c, gain, q)[source]#

Return (b, a) for a peaking section.

Return type:

tuple[Any, Any]

pyFDN.eq.design module#

Map decay targets or gain targets to EQ coefficients.

The public functions are grouped by the quantity a caller knows first: reverberation time for an attenuation filter, or gain in dB for an output EQ. The lower-level filter-section formulas live in pyFDN.eq.biquads, while the graphic-EQ implementation lives in pyFDN.eq.graphic_eq.

pyFDN.eq.design.decay_to_first_order_shelf(rt, delays, fs, *, rt_nyquist, crossover=None)[source]#

Design first-order attenuation shelves from endpoint RTs in seconds.

crossover is the shelf frequency in Hz; None uses fs / 4.

Return type:

Any

pyFDN.eq.design.decay_to_graphic_eq(rt, delays, fs)[source]#

Design attenuation GEQs from ten reverberation times in seconds.

rt is ordered on COMMAND_FREQUENCIES (31.25 Hz through 16 kHz).

Return type:

Any

pyFDN.eq.design.decay_to_one_pole(rt, delays, fs, *, rt_nyquist)[source]#

Design one-pole attenuation filters from endpoint RTs in seconds.

Return type:

Any

pyFDN.eq.design.decay_to_two_stage(rt, delays, fs, *, crossover=None)[source]#

Design two-stage attenuation filters from ten reverberation times.

rt is ordered on COMMAND_FREQUENCIES (31.25 Hz through 16 kHz). See gain_to_two_stage().

Return type:

Any

pyFDN.eq.design.gain_to_first_order_shelf(gain_db, fs, *, gain_db_nyquist, crossover=None)[source]#

Design a first-order shelf from its endpoint amplitudes in dB.

crossover is the shelf frequency in Hz; None uses fs / 4.

Return type:

Any

pyFDN.eq.design.gain_to_one_pole(gain_db, *, gain_db_nyquist)[source]#

Design a one-pole filter from its endpoint amplitudes in dB.

Return type:

Any

pyFDN.eq.design.gain_to_two_stage(gain_db, fs, *, crossover=None, design_matrix=None)[source]#

Design a two-stage EQ from ten amplitudes in dB.

The first stage is a first-order shelf through the lowest and highest band targets, which fixes the gain towards DC and Nyquist. The second stage is a graphic EQ fitted to what the shelf leaves over in each band. crossover is the shelf crossover in Hz; None uses 1 kHz.

gain_db has shape (10,) or (10, n_channels) and is ordered on COMMAND_FREQUENCIES (31.25 Hz through 16 kHz). The result stacks the shelf section before the gain_to_graphic_eq() sections.

Reference: V. Välimäki, K. Prawda, and S. J. Schlecht, “Two-Stage Attenuation Filter for Artificial Reverberation,” IEEE Signal Process. Lett., vol. 31, pp. 391-395, 2024, doi:10.1109/LSP.2024.3352510.

Return type:

Any

pyFDN.eq.graphic_eq module#

Ten-band graphic equalizer design.

This module owns the graphic-EQ band layout, least-squares control problem, and biquad assembly. Public function names use the established geq abbreviation; graphic_eq is used when naming the design itself.

pyFDN.eq.graphic_eq.gain_to_bounded_graphic_eq(gain_db, fs, *, max_command_gain_db=20.0)[source]#

Design a graphic EQ with bounded internal section gains.

This is the constrained, NumPy-only counterpart of gain_to_graphic_eq(). The flat-gain section remains unbounded; each of the ten frequency-shaped sections is limited to max_command_gain_db in either direction.

gain_db has shape (10,) or (10, n_channels) and is ordered on COMMAND_FREQUENCIES (31.25 Hz through 16 kHz).

Return type:

ndarray

pyFDN.eq.graphic_eq.gain_to_graphic_eq(gain_db, fs, *, design_matrix=None)[source]#

Design a ten-band graphic EQ from amplitudes in dB.

gain_db has shape (10,) or (10, n_channels) and is ordered on COMMAND_FREQUENCIES (31.25 Hz through 16 kHz).

Return type:

Any

pyFDN.eq.graphic_eq.graphic_eq_design_matrix(fs)[source]#

Return the constant map from ten band targets to eleven command gains.

Return type:

ndarray

pyFDN.eq.probe_sos module#

Frequency response probing of a cascade of biquad sections.

Translation of probeSOS.m from fdnToolbox.

pyFDN.eq.probe_sos.probe_sos(sos, fs, *, control_frequencies=None, nfft=4096)[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).

  • fs (float) – Sampling frequency in Hz.

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

  • nfft (int) – Number of frequency points of the response.

Returns:

(G, H, W) where

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

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

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

Return type:

tuple[ndarray, ndarray, ndarray]

Module contents#

Filter sections and target-to-EQ design functions.