pyFDN package#

Subpackages#

Submodules#

pyFDN.dss module#

The delay state-space (DSS) matrices of an FDN.

class pyFDN.dss.DSS(delays, A, B, C, D)[source]#

Bases: NamedTuple

Delay state-space system: the standard matrices of an FDN, nothing else.

delays holds one length per delay line, in samples. A is the (N, N) feedback matrix, B the (N, inputs) input gains, C the (outputs, N) output gains and D the (outputs, inputs) direct path. A filter (FIR) feedback matrix is not a DSS matrix; it goes into a graph’s post_matrix hook, as a td.MatrixFIR or a pyFDN.fir_matrix_module().

The field order is the argument order of the dss_to_* functions, so a system unpacks straight into them. Filters and the sample rate are not part of the system; pass them alongside, e.g. pyFDN.dss_to_td(*dss, post_delay=sos).

A: ndarray#

Alias for field number 1

B: ndarray#

Alias for field number 2

C: ndarray#

Alias for field number 3

D: ndarray#

Alias for field number 4

delays: ndarray#

Alias for field number 0

pyFDN.process module#

One-shot processing of a delay state-space (DSS) system.

pyFDN.process.process_dss(delays, A, B, C, D, signal)[source]#

Process a signal through a delay state-space system.

One-shot form of dss_to_td(...).process_signal(signal): a fresh pyFDN.td graph is built for every call. The system comes first, as in pyFDN.dss_to_impz() and scipy.signal.lfilter(), so a DSS unpacks straight in: process_dss(*dss, x). With filters, build the graph: dss_to_td(*dss, **filters).process_signal(x, squeeze=True).

Parameters:
  • delays (ArrayLike) – Positive delay lengths in samples, shape (N,).

  • A (ArrayLike) – Feedback, input, output, and direct gain matrices.

  • B (ArrayLike) – Feedback, input, output, and direct gain matrices.

  • C (ArrayLike) – Feedback, input, output, and direct gain matrices.

  • D (ArrayLike) – Feedback, input, output, and direct gain matrices.

  • signal (ArrayLike) – Input of shape (num_samples,) or (num_samples, num_inputs).

Returns:

Processed signal with singleton dimensions removed.

Return type:

ndarray

pyFDN.references module#

Citation helpers backed by the bibliography distributed with pyFDN.

Return a Markdown citation link for a packaged bibliography entry.

Return type:

str

pyFDN.references.paper_reference(paper_id)[source]#

Return a copy of the bibliography fields for paper_id.

Return type:

dict[str, str]

pyFDN.save module#

Save and load any pyFDN object, and the presets that ship with pyFDN.

A DSS is saved as readable JSON: its five fields as nested lists, one matrix row per line, plus the pyFDN version that wrote it.

Anything else – a td graph, a FLAMO model – is two pickles: a header naming the pyFDN and Python versions that wrote it, then the object itself, written with cloudpickle so FLAMO models (which hold lambdas) save too. There is no format to maintain for these: when a refactor breaks an old file, map the moved class in RENAMED or rebuild the object, then resave_fdn() it. Loading a pickle runs code from the file, so only load pickles you or pyFDN wrote.

pyFDN.save.RENAMED: dict[tuple[str, str], tuple[str, str]] = {}#

(old module, old name) -> (new module, new name) for classes that moved since a pickle was saved, e.g. {("pyFDN.dss", "DSS"): ("pyFDN.system", "DSS")}.

pyFDN.save.available_fdn_presets()[source]#

Return the names accepted by load_fdn_preset().

Return type:

tuple[str, ...]

pyFDN.save.load_fdn(path)[source]#

Load an object written by save_fdn().

A JSON file is read as data. A pickle runs code from the file, so only load pickles you trust.

Return type:

Any

pyFDN.save.load_fdn_preset(name)[source]#

Return a packaged FDN as a DSS.

The colorless presets come from Dal Santo et al., Differentiable Feedback Delay Network For Colorless Reverberation (MIT licence, see pyFDN/resources/ATTRIBUTION.md). They were designed at 48 kHz.

Return type:

DSS

pyFDN.save.resave_fdn(path)[source]#

Rewrite a saved file with the installed pyFDN, applying RENAMED.

Return type:

None

pyFDN.save.save_fdn(obj, path)[source]#

Save obj together with the version of pyFDN that wrote it.

A DSS becomes readable JSON. Anything else that pickles – a td graph, a FLAMO model, a (dss, filters) pair – is pickled. A FLAMO model’s lambdas are stored as Python bytecode, so its file loads only on the same Python minor version; nothing else depends on it.

Return type:

None

Module contents#

See API Reference for full documentation of all functions and classes.