Acoustic DNA Resonator — Differentiable FDN

Analyzes a sound's spectral envelope, per-band decay rates, and modal peaks — its "acoustic DNA" — then trains a differentiable Feedback Delay Network (FDN) whose impulse response approximates those features. The same input is passed through the trained FDN as a self-derived resonator / spectral feedback chamber.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 0.2.2 (2026) License: MIT License Repo: https://github.com/ShaiCohen-ops/Praat-plugin_AudioTools
Contents:

What this does

This script implements an Acoustic DNA Resonator — it analyses the selected Sound's spectral envelope, per-band decay rates, and modal peaks (the "acoustic DNA"), then trains a small differentiable Feedback Delay Network (PyTorch) whose impulse response approximates those features. The same input sound is then passed through the trained FDN as a self-derived resonator / spectral feedback chamber, dry/wet mixed, and returned as a new (optionally multichannel) Sound.

What is a Feedback Delay Network (FDN)? An FDN is a reverberation structure consisting of parallel delay lines with a feedback matrix. It can produce complex, dense impulse responses with independent control over decay rates per frequency band. This script uses a Householder-parameterised orthogonal feedback matrix, one-pole shelf damping filters, and fixed prime delay lengths. The network is trained so its impulse response matches the input's spectral features — effectively "learning" the sound's resonances.

Key Features:

Performance: The engine uses a Sherman-Morrison closed-form transfer function (O(n) per frequency bin instead of O(n³)), making training and rendering fast. A default run drops from ~4.5 minutes to ~35 seconds. Per-stage timings (analyze/train/render) are shown in the report.

Quick start

  1. In Praat, select exactly one Sound object.
  2. Run script…AcousticDNAResonator.praat.
  3. Choose a preset from the dropdown (Bright shimmer chamber, Dark long decay, Subtle enhancement, or Custom).
  4. Adjust parameters: FDN size (4–32), IR duration (0.25–15 s), Epochs (10–5000), Dry/wet mix, Normalize mode, Output channels.
  5. Optionally select a TextGrid (first tier, non-empty intervals) for event-based analysis.
  6. Click OK — Python engine analyses the sound, trains the FDN, renders output.
  7. Result originalname_dnares appears in the Objects window.
Quick tip: Start with Bright shimmer chamber for a short, bright resonance (small FDN, short IR, more wet). Dark long decay for a cavernous, dark reverb (large FDN, long IR). Subtle enhancement for a light touch (mostly dry). Enable Draw_visualization to see the training loss curve and per-band decay estimates.
Important: Python dependencies required: pip install numpy scipy soundfile torch. The engine analyses the input's spectral envelope and trains an FDN to match it. Training is CPU/GPU-safe — the default run takes 30–60 seconds on a modern CPU. The output can be multichannel (up to 8 channels); when output channels match input channels, each output channel processes its own input channel, preserving the spatial image.

3 Presets

PresetFDN SizeIR Duration (s)EpochsDry/WetCharacter
Bright shimmer chamber102.06000.55Short, bright resonance — favours upper partials
Dark long decay246.010000.45Cavernous, dark reverb — large FDN, long IR
Subtle enhancement122.55000.18Light touch — mostly dry, subtle resonance

FDN Theory — Differentiable Feedback Delay Network

FDN structure

An FDN consists of N parallel delay lines with lengths dᵢ, a feedback matrix A, and input/output gains g_in, g_out. The per-line transfer function is:

D(z) = g₀ · (1 - a) / (1 - a·z⁻ᵈ) (one-pole shelf damping)

Feedback matrix: Householder reflector — A = I - 2vvᵀ with ‖v‖ = 1. Orthogonal by construction, stable, and parameterised by a single vector.

Transfer function: H(z) = g_outᵀ · (I - D(z)A)⁻¹ · D(z) · g_in

Sherman-Morrison closed form (v0.2)
For Householder feedback, I - D·A = (I - D) + 2·D·v·vᵀ is diagonal plus rank-1. The exact inverse is computed elementwise:
  • B = I - D (diagonal)
  • u = 2·D·v
  • denom = 1 + vᵀ · B⁻¹ · u
  • H = B⁻¹ · g_in - B⁻¹ · u · (vᵀ · B⁻¹ · g_in) / denom
This is O(n) per frequency bin instead of O(n³) — the difference between 35 seconds and 4.5 minutes (and why the DarkLongDecay preset no longer allocates ~4 GB of memory).
Training objective: The FDN's impulse response is compared to the analysed "acoustic DNA" using a multi-resolution STFT loss (three FFT sizes) and a per-band decay loss. The network learns the feedback matrix parameters, damping filters, and input/output gains to match the input's spectral envelope and decay rates.

Parameters

Core parameters

ParameterRangeDefaultDescription
Preset4 options + CustomBright shimmer chamberQuick configuration for different resonance characters
FDN_size4–3216Number of parallel delay lines — larger = denser reverb
IR_duration0.25–15 s4.0Length of the impulse response to train and render
Epochs10–5000800Training iterations — more = better fit, slower
Dry_wet0–10.35Blend of dry (original) and wet (resonated) signals
Normalize_modenone / peak / rms / loudnessrmsOutput level normalisation
Out_channelsmatch input / mono / stereo / 4–8match inputNumber of output channels — preserves spatial image
Per-channel excitation: When output channels match input channels (and > 1), each output channel processes its own input channel through its own decorrelated tap. The dry signal is preserved per channel. This means a stereo or multichannel input retains its spatial image while each channel gets its own resonant processing.

Applications

Creative reverb / resonance design

Use case: Turn any sound into its own resonant chamber — the FDN learns the input's spectral DNA and creates a custom reverb tailored to that sound.

Settings: Dark long decay preset for cavernous reverb; Bright shimmer chamber for short, bright resonance.

Multichannel spatial processing

Use case: Process a stereo or surround recording with per-channel decorrelated taps, preserving the spatial image.

Settings: Out_channels = match input. Each channel excites its own decorrelated tap of the same trained FDN.

Experimental instrument design

Use case: Use the FDN as a performable resonator — feed different inputs through the same trained FDN for timbral variation.

Settings: Train on a base sound (e.g., a piano note), then process other sounds through the same FDN for cross-synthesis.

Workflow: Voice → Dark cavernous reverb

Source: Spoken word or sung phrase.
Settings: Dark long decay preset (FDN=24, IR=6s, dry/wet=0.45).
Result: The voice is placed in a custom, cavernous space that matches its spectral character — the reverb tail follows the voice's formants and decay rates.

Workflow: Stereo field recording → Resonant spatialisation

Source: Stereo field recording (birds, water, wind).
Settings: Subtle enhancement preset, Out_channels = match input (stereo).
Result: Each stereo channel gets its own decorrelated resonant treatment — the spatial image is preserved while the sound takes on a subtle, shimmering resonance.

Workflow: Piano → Bright shimmer chamber

Source: Piano recording.
Settings: Bright shimmer chamber preset (FDN=10, IR=2s, dry/wet=0.55).
Result: The piano's partials are enhanced by a bright, shimmering resonance — like the piano is playing inside a metal chamber.

Troubleshooting:
Training is slow: Reduce FDN_size (8–12), reduce Epochs (300–500), or use a GPU (--device cuda in the Python backend).
Output is silent or distorted: Check that the input has reasonable amplitude. The FDN is trained on the input's spectral envelope; very quiet inputs may produce near-silent output.
Multichannel output has channel imbalance: The decorrelated taps are unit-norm scaled to sqrt(n) so expected energy matches. If imbalance persists, check the source channel levels.
Training loss not decreasing: The FDN may be too large for the input (try smaller FDN_size) or the IR_duration too short (increase to 4–6 s).
TextGrid events not used: v0.1 exports events from the TextGrid but they are informational only (not yet used to drive time-varying targets). Future versions will use them for event-aware training.

Visualisation

When Draw_visualization is enabled, the script generates:
  • Input waveform — the original sound
  • Rendered output spectrogram — the resonating sound (channel 1)
  • Training loss curve — shows how the FDN fits the input's acoustic DNA
  • Per-band decay bar chart — estimated decay times per frequency band (low → high Hz)
  • Summary panel — FDN size, epochs, loss values, decay estimate, RMS, delays
The loss curve and decay chart are particularly useful for understanding the FDN's behaviour and diagnosing training issues.