pyFDN.dsp package#
Submodules#
pyFDN.dsp.dfilt_matrix module#
Matrix of FIR filters with persistent state (dfiltMatrix translation).
The MATLAB toolbox wraps every matrix entry in a dfilt object; here only
the FIR-matrix case is needed (used for paraunitary / velvet feedback
matrices). Scalar matrices are handled directly by process_fdn and IIR
per-delay-line absorption is handled by
pyFDN.dsp.sos_filter_bank.SOSFilterBank, so neither needs this class.
- class pyFDN.dsp.dfilt_matrix.FIRMatrixFilter(coefficients)[source]#
Bases:
objectApply a matrix of FIR filters to a multichannel signal, block by block.
- Parameters:
coefficients ((n_out, n_in, order) array) – FIR coefficients per matrix entry in z^{-1} convention (
coefficients[i, j, k]is the tap ofz^{-k}from inputjto outputi).
:param Filter state persists across calls to
filter(): :param so a long signal: :param can be processed in consecutive blocks.:
pyFDN.dsp.feedback_delay module#
pyFDN.dsp.sos_filter_bank module#
Bank of per-channel SOS filter cascades with persistent state.
Used for per-delay-line absorption filters in process_fdn; the SOS-cascade
counterpart of pyFDN.dsp.dfilt_matrix.FIRMatrixFilter.
- class pyFDN.dsp.sos_filter_bank.SOSFilterBank(sos, num_channels)[source]#
Bases:
objectApply one SOS filter cascade per channel, block by block.
- Parameters:
sos (array) – Per-channel SOS bank of shape
(n_sections, 6, N)whereN = num_channels. Section rows are[b0, b1, b2, a0, a1, a2]. This is the canonical SOS bank layout in pyFDN: it matches the FLAMOparallelSOSFilterinput and the output ofpyFDN.first_order_absorption(),pyFDN.one_pole_absorption(), andpyFDN.absorption_geq().num_channels (int) – Number of channels N.
:param Filter state persists across calls to
filter(): :param so a long signal: :param can be processed in consecutive blocks.:
pyFDN.dsp.time_varying_matrix module#
Time Varying matrix generator for FDN feedback matrices.
This module provides a Python implementation of a time-varying matrix generator for Feedback Delay Network (FDN) feedback matrices. Translation of the MATLAB implementation timeVaryingMatrix.m from fdnToolbox.
Original MATLAB code: (c) Sebastian Jiro Schlecht, 2019 Python translation: Alma Hova, 2026
- class pyFDN.dsp.time_varying_matrix.TimeVaryingMatrix(N, cycles_per_second, amplitude, fs, spread)[source]#
Bases:
objectTime Varying Matrix for Feedback Delay Networks (FDNs).
This class generates a time-varying matrix for FDN feedback matrices. The matrix varies over time based on sinusoidal modulation, with parameters controlling the speed, amplitude, and randomness of the variation.
- Parameters:
N (int) – Number of channels (size of the matrix is N x N). Must be a positive even integer.
cycles_per_second (float) – Frequency of the time variation in Hz (controls oscillation speed).
amplitude (float) – Maximum angle deflection in radians (strength of modulation).
fs (float) – Sampling rate in Hz.
spread (float) – Randomness factor (controls how differently each eigenmode behaves).
- filter(x_in)[source]#
Applies a time-varying orthogonal transformation to the input signal.
Each adjacent channel pair is rotated by a sinusoidally modulated angle. The operation is equivalent to constructing the block-diagonal rotation matrix from
rotation_matrix_from_anglesat every sample, but applies the 2-D rotations directly to the whole input block.- Parameters:
x_in (ndarray) – Input signal of shape (length, N), where length is the number of samples and N is the number of channels.
- Returns:
out – Output signal of the same shape as x_in.
- Return type:
ndarray
Module contents#
pyFDN DSP utilities and components.