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: object

Apply 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 of z^{-k} from input j to output i).

:param Filter state persists across calls to filter(): :param so a long signal: :param can be processed in consecutive blocks.:

filter(block)[source]#

Filter a block of shape (block_size, n_in) to (block_size, n_out).

Return type:

ndarray

pyFDN.dsp.feedback_delay module#

class pyFDN.dsp.feedback_delay.FeedbackDelay(delays, max_block_size)[source]#

Bases: object

Vectorised block delay lines for the FDN.

advance(block_size)[source]#
Return type:

None

get_values(block_size)[source]#
Return type:

ndarray

set_values(block)[source]#
Return type:

None

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: object

Apply one SOS filter cascade per channel, block by block.

Parameters:

:param Filter state persists across calls to filter(): :param so a long signal: :param can be processed in consecutive blocks.:

filter(block)[source]#

Filter a block of shape (block_size, N) channel-wise.

Return type:

ndarray

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: object

Time 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_angles at 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.