pyFDN.MatchEnergyDecay#
- class pyFDN.MatchEnergyDecay(target, *, window=4096, hop=None, bands=None, floor_db=-45.0)[source]#
RMS dB error of the octave-band energy decay curves against a reference.
The loss that sees the decay – and the one to add when the decay is a trained parameter (a
AttenuationFilterin thepost_delayhook). A magnitude spectrogram distance is not a substitute for fitting a decay; see the design note.Each band’s Schroeder curve is normalized to its own value at \(t=0\), so the loss reads the decay and nothing else – level is left to whatever else is in the objective.
The value is in dB, which puts it many orders of magnitude above a spectrogram distance: weight accordingly, and read
TrainLog.loss_log(which stores every term unweighted) to see what each term is worth.- Parameters:
target (
Any) – Reference IR, shape(n_samples,),(n_samples, n_out)or(n_samples, n_out, n_in). Zero-padded or truncated to the model’snfft.window (
int) – STFT window and hop in samples for the band energies. The default 4096 (85 ms at 48 kHz) resolves the 63 Hz octave; shorter windows leave the low bands with too few bins to be worth reading.hop (
int|None) – STFT window and hop in samples for the band energies. The default 4096 (85 ms at 48 kHz) resolves the 63 Hz octave; shorter windows leave the low bands with too few bins to be worth reading.bands (
Any) – Band edges in Hz; defaults to the octave bands from 44 Hz to 11.3 kHz.floor_db (
float) – Only the part of each band’s curve where the target is still above this level is compared. Past it a measurement is reading its own noise floor, and fitting that would fit the microphone.
Methods
__init__(target, *[, window, hop, bands, ...])check(model)Preflight against the model it will train, before the first step.
terms()Flatten into
(weight, loss)leaves.Attributes
nameShort label, used as the key in
pyFDN.TrainLog.loss_log.