pyFDN.trainable_from_dss#
- pyFDN.trainable_from_dss(delays, A, B, C, D, fs, *, trainable=None, matrix='orthogonal', post_delay=None, post_matrix=None, post_output=None, nfft=65536, alias_decay_db=0.0, device=None, dtype=None)[source]#
Build a trainable flamo
Shellinitialized from aDSS.The gains and the feedback matrix come from the system. Each filter hook is either a baked SOS bank, wired in frozen, or a module – which is how a designed, trainable filter gets in, since baked values do not remember the reverberation time or the EQ curve they were designed from:
model = pyFDN.trainable_from_dss( *dss, fs, post_delay=pyFDN.AttenuationFilter( 1.0, dss.delays, fs, rt_nyquist=1.0, design="first_order_shelf", nfft=nfft), post_output=pyFDN.OutputEQ( 0.0, dss.C.shape[0], fs, design="first_order_shelf", nfft=nfft), )
Baked filters from
pyFDN.flamo_to_dss()go straight back in:trainable_from_dss(*dss, fs, **filters).Both modules default to
requires_grad=True.- Parameters:
delays (
ArrayLike) – Initial delay state-space system; aDSSunpacks straight in, as for everydss_*function.A (
ArrayLike) – Initial delay state-space system; aDSSunpacks straight in, as for everydss_*function.B (
ArrayLike) – Initial delay state-space system; aDSSunpacks straight in, as for everydss_*function.C (
ArrayLike) – Initial delay state-space system; aDSSunpacks straight in, as for everydss_*function.D (
ArrayLike) – Initial delay state-space system; aDSSunpacks straight in, as for everydss_*function.fs (
float) – Sampling rate in Hz.trainable (
Trainable|None) – Which gain groups are trained (defaultTrainable). It says nothing about the filter hooks: each module below carries its ownrequires_grad, and is wired in exactly as it was built.matrix (
Literal['orthogonal','random']) – Feedback-matrix parametrization.post_delay (
Any) – In-loop filter. A baked(sections, 6, N)SOS bank is wired in frozen. AAttenuationFilterhere makes the trained parameter the reverberation time itself, which keeps the loop contractive for every value it can take.post_matrix (
Any) – Filter on the feedback path.post_output (
Any) – Output EQ; typically anOutputEQ. It sits outside the recursion, which makes it the only part of an FDN that can shape the response’s spectral envelope without touching the decay –bandcare single numbers per delay line, with no frequency dependence at all.nfft (
int) – FFT size.alias_decay_db (
float) –The accuracy of the rendered impulse response, in dB. Applies a \(\gamma^n\) envelope to every module (evaluating the system on a circle of radius \(\gamma < 1\)); the shell’s output layer removes it again, so the response is the true one and only the time-aliased wrap-around remains, suppressed by exactly
alias_decay_db. In float32 the reconstruction amplifies round-off by the same factor, so ~60 dB is the practical ceiling; usedtype=torch.float64beyond that.Leave at 0 for a decaying FDN, which damps itself within
nfftsamples. A lossless FDN needs it: with its poles exactly on the unit circle the FFT-domain evaluation is near-singular and the response comes out wrong, not merely aliased. It does not affect the extracted system (it enters the frequency-domain evaluation, not the parametermap, sopyFDN.flamo_to_dss()still returns the undampedA/B/C). A module you pass into a hook must have been built with the same value: it is a change of evaluation radius for the whole system, not a per-module gain.device (
Any) – Torch device / dtype (default cpu-or-cuda / float32).dtype (
Any) – Torch device / dtype (default cpu-or-cuda / float32).
- Return type: