API Reference#
All functions and classes are accessible from the top-level pyFDN namespace:
import pyFDN
feedback = pyFDN.random_orthogonal(4)
The reference is organised by functional area, mirroring the package’s module
structure. It covers the headline public API; a small number of low-level
helpers are exported for advanced/composability use but intentionally omitted
here (see tests/test_api_reference.py).
Matrix Generators#
Generate a random orthogonal matrix distributed according to the Haar measure. |
|
Randomly shift polynomial matrices in time. |
|
Shift a polynomial matrix in time-domain by |
|
Randomly distribute time shifts for a polynomial matrix. |
|
Create a Householder reflection matrix from a vector. |
|
Build an N×N block-circulant orthogonal matrix. |
|
Solve the orthogonal completion problem for feedback matrix A. |
|
Return the nearest orthogonal matrix to A in the Frobenius norm. |
|
Find the orthogonal matrix U minimising |
|
Build the degree-one lossless polynomial matrix |
|
Create combs and allpass filters as a single FDN. |
|
Create an allpass structure embedded in an FDN of size [2N, 2N]. |
|
Construct a paraunitary matrix and its reverse response. |
|
Construct a random paraunitary matrix as a cascade of elemental factors. |
|
Wrapper for |
|
Generate orthogonal matrix with small eigenvalue angles. |
|
Generate orthogonal matrix with prescribed eigenvalue angles. |
|
Return a feedback matrix of the requested type, or list all type names. |
|
Return a full FDN system (A, B, C, D) of the requested type, or list all type names. |
|
Return an FIR (filter) feedback matrix of the requested type, or list all type names. |
|
Build a complete FDN from a delay range, a reverberation time, and an EQ. |
|
Generate |
|
Full FDN system matrices returned by |
|
Complete FDN parameters returned by |
Allpass FDN#
Generate allpass FDN with homogeneous decay: V = [A,b;c,d] uniallpass, A = U @ G. |
|
Generate a random admissible diagonal matrix P for homogeneous uniallpass FDN. |
|
Compute a completion (B,C,D) for given A. |
|
Full MIMO (k=N) Halmos/Julia dilation. |
|
General MIMO completion via defect subspace (CS/SVD-based). |
|
Create Gardner's nested allpass FDN (SISO). |
|
Create Poletti's MIMO unitary reverberator (allpass FDN). |
|
Create Schroeder's series allpass FDN (SISO). |
|
Test whether the delay state-space system is allpass. |
|
Test whether the FDN is uniallpass (lossless with a diagonal Lyapunov matrix). |
|
Test whether a MIMO impulse response is paraunitary (lossless). |
Scattering Delay Network#
Minimal SDN: from room and source/receiver, compute only network parameters (delay lengths, routing, scattering matrices, wall filters) for use in an FDN. |
Acoustics & Absorption#
Generate FIR absorption filters for each channel. |
|
Design first-order shelving absorption filters according to specified reverb time. |
|
Design first-order shelving EQ filters from gains in dB at DC and Nyquist. |
|
Design one-pole absorption filters according to specified reverb time. |
|
Magnitude response (gain per sample vs angle) for a per-channel SOS bank. |
|
Echo density and mixing time (Abel & Huang 2006). |
|
Energy decay curve: backward cumulative sum of squared signal along an axis. |
|
Compute reverb time from recursive absorption filter with delay. |
|
Estimate the initial level of the exponential decay per octave band. |
|
Estimate RT in octave bands via Butterworth bandpass filtering. |
|
Convert reverb time (seconds) to gain coefficient per sample. |
|
Convert reverb time (RT, seconds) to energy decay slope (dB per sample). |
|
Convert slope (dB/sample) to reverb time in seconds. |
Graphic EQ#
Design a 10-band graphic EQ matching a target magnitude response. |
|
Build a graphic EQ as a bank of independent biquad sections. |
|
Design per-delay GEQ absorption filters matching target reverberation times. |
|
Evaluate the magnitude response of each biquad at control frequencies. |
|
Design a shelving biquad filter. |
|
Design a peaking bandpass biquad filter. |
DSP Components#
Vectorised block delay lines for the FDN. |
|
Apply a matrix of FIR filters to a multichannel signal, block by block. |
|
Apply one SOS filter cascade per channel, block by block. |
Delay Utilities#
Rank-1 approximation of matrix group delay. |
|
Group delay for each entry of an FIR matrix. |
|
Convert milliseconds to samples. |
|
Return a FLAMO model's time response as a NumPy array. |
|
Return a FLAMO model's (complex) frequency response as a NumPy array. |
Polynomial & Matrix Maths#
Adjugate of a polynomial matrix via FFT evaluation. |
|
Adjugate matrix, valid also for singular and complex matrices. |
|
Determinant of a polynomial matrix in the z^{-1} convention. |
|
Generalized characteristic polynomial (GCP) for delay state-space. |
|
Geodesic interpolation between two orthogonal matrices. |
|
Check if Q is orthogonal (Q.T @ Q ≈ I). |
|
Test whether A is diagonally similar to an orthogonal matrix. |
|
Loop transfer function |
|
Matrix polynomial multiplication by convolution. |
|
Derivative of rational filter matrices in the z^{-1} convention. |
|
Evaluate a matrix polynomial |
|
Matrix square root via eigenvalue decomposition. |
|
Derivative of rational polynomial with negative exponents. |
|
Rank-1 approximation minimizing |
|
Return the polynomial degree in the z^{-1} convention. |
|
Derivative of rational polynomial using quotient rule. |
|
Construct a diagonal polynomial matrix from an array of polynomials. |
General Utilities#
Convert decibel values to linear magnitude. |
|
Convert decibel values to squared magnitude (power). |
|
Convert linear magnitude to decibels with numerical guard. |
|
Convert squared magnitude (power) to decibels with numerical guard. |
|
Ensure the matrix has a trailing polynomial dimension. |
|
Convert frequency (Hz) to normalised frequency (0-1). |
|
Convert frequency (Hz) to angular frequency (rad/sample). |
|
Convert angular frequency (rad/sample) to frequency (Hz). |
|
Check if all value points are bounded by the curve. |
|
Return 1-based indices of the last non-zero element along axis 2. |
|
Pairwise maximum normalized cross-correlation of a MIMO signal matrix. |
|
Mu-law companding (decode): companded to linear amplitude. |
|
Mu-law companding (encode): linear amplitude to companded. |
|
Scale array so the maximum absolute value equals target_peak. |
|
Load a packaged audio file as a NumPy array. |
|
Find upper and lower pole boundaries for FDN loop. |
|
Return skew-symmetric matrix from upper triangle (Matlab skew convention). |
State-Space Translators#
Convert delay state-space (DSS) FDN to standard state-space. |
|
Compute MIMO impulse response from delay state-space (DSS) representation. |
|
From delay state-space to transfer function matrix (numerator and denominator). |
|
Modal decomposition of an FDN from raw DSS matrices. |
|
Build a FLAMO model from delay state-space (A, B, C, D, m). |
|
Build a FLAMO model from a complete |
|
Poles/residues from a FLAMO transfer |
|
Decompose a FLAMO model into the subgraphs needed for poles/residues. |
|
Extract the H(z)=C P(z)^{-1}B+D probes from a FLAMO model. |
|
Decomposition of a FLAMO model into small subgraphs for poles/residues. |
|
Estimate residues from impulse response and known poles via least squares. |
|
Compute MIMO impulse response from matrix transfer function (numerator/denominator). |
|
Synthesize impulse response from poles and residues. |
FDN Processing#
Simulate the feedback delay network using block processing. |
|
Run a 1-D signal through a FLAMO |
Training#
Build a trainable flamo |
|
Build a trainable flamo |
|
Return a copy of |
|
Which FDN parameter groups are trained. |
|
Train |
|
Per-step loss history and stopping info from a training run. |
Plotting#
Plot a single matrix as a Plotly heatmap (RdBu, square pixels). |
|
Plot several matrices as a grid of Plotly heatmaps sharing one color scale. |
|
Plot system matrix [A b; c d] as 2x2 Plotly heatmaps, shared RdBu color scale. |
|
Plot all FDN parameters in one figure. |
|
Plot the parameters stored in an |
|
Plot SOS magnitude responses normalized by delay length (dB per sample). |
|
Plot one or more impulse responses over time, mu-law compressed by default. |
|
Plot matrix of impulse responses in a subplot grid (out x in). |
|
Plot the energy decay curve (EDC) of one or more impulse responses. |
|
Plot spectrogram of a 1-D signal as a Matplotlib image. |
|
Animate a sequence of frames built by any per-frame plotting function. |
|
Create a Plotly |
|
Downsample a line while preserving local minima and maxima. |
|
Return a copy of a Plotly trace with downsampled |
FLAMO Graph#
Draw the FLAMO model signal flow with matplotlib. |
|
Traverse a FLAMO model and build a tree of nodes (nested dicts). |
|
Flatten the node tree into a list of nodes, each with a 'path' key. |
|
Extract a complete |