Beltrami Inspired Spectral Melter — User Guide

An edge-aware time-frequency diffusion instrument: it turns a spectrogram into a dB terrain, diffuses that terrain anisotropically, exaggerates the resulting spectral shape, and resynthesizes it by overlap-add.

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

What this does

Beltrami Inspired Spectral Melter treats the source spectrogram as a two-dimensional terrain whose axes are time and frequency. It converts spectral energy to dB, measures local gradients, diffuses the terrain more freely in smooth areas than across strong ridges, exaggerates the diffused spectral shape, then resynthesizes a new Sound by overlap-add.

The result is not a conventional filter or reverb. It is a time-varying spectral morphology: energy can smear through neighbouring time frames and frequency bins while prominent ridges can be protected to different degrees.

The name is intentionally “Beltrami Inspired”. The script does not solve a full Laplace–Beltrami PDE on a curved manifold. Its implemented diffusion law is much closer to an edge-preserving Perona–Malik-style anisotropic diffusion operating on a rectangular time-frequency grid.

Beltrami and anisotropic diffusion

The Laplace–Beltrami operator generalizes the ordinary Laplacian from flat Euclidean space to curved Riemannian manifolds. In broad terms, Laplacian diffusion smooths a field by letting values flow toward their neighbours.

Anisotropic diffusion makes that flow direction- or content-dependent. Here the script computes a local gradient magnitude g and uses a conductance term of the form:

c(g) = exp(-(g / κ)^2)\nκ = Ridge_sensitivity / Edge_preservation

Small gradients receive conductance near 1 and diffuse readily. Strong ridges receive lower conductance and are protected. Time and frequency have separate diffusion strengths.

Reevaluate edges each iteration changes the character substantially. Off = the initial gradient field remains fixed. On = the gradient/conductance field is recomputed from the current diffused terrain every iteration, which is the closer analogue to classical Perona–Malik diffusion.

Quick start

  1. Select exactly one Sound.
  2. Run Beltrami_Inspired_Spectral_Melter.praat.
  3. Choose one of the seven named presets or Custom.
  4. Choose mono or stereo output with Create_stereo.
  5. For stereo, use Stereo_phase_offset: 0 gives matching phase fields; 1 gives the widest independent phase difference.
  6. Choose a Speed mode.
  7. Use Edit_details only when you need analysis, diffusion, strength, wet/dry or seed control.

Presets

Diffusion and mix

PresetWindow / stepIterationsTime / freq diffusionStrengthWet
Custom40 / 10 ms60.15 / 0.123.00.85
Shimmer Haze40 / 10 ms80.20 / 0.052.50.80
Deep Terrain60 / 15 ms120.20 / 0.184.00.90
Edge Freeze30 / 8 ms50.10 / 0.082.00.70
Fog of War50 / 12 ms100.12 / 0.224.00.88
Formant Cloud35 / 8 ms70.18 / 0.063.00.75
Transient Glass25 / 6 ms60.22 / 0.043.50.82
Void Chasm100 / 40 ms180.24 / 0.208.01.00

Analysis and edge protection

PresetMax HzFreq res.Floor dBRidge sensitivityEdge preservation
Custom6000100 Hz-801.81.0
Shimmer Haze600080 Hz-802.51.2
Deep Terrain5000100 Hz-701.20.8
Edge Freeze700070 Hz-803.52.0
Fog of War5000120 Hz-751.50.9
Formant Cloud500050 Hz-802.01.5
Transient Glass800080 Hz-804.02.5
Void Chasm12000150 Hz-802.51.5

Reevaluate edges each iteration remains off unless changed in Edit details. Create_stereo, Stereo_phase_offset, Speed mode and Random seed also remain user choices. Max frequency is reduced when necessary to stay below the working Nyquist frequency by at least one requested frequency-resolution step.

Main controls

ControlDefaultMeaning
PresetCustomLoads analysis, diffusion, effect-strength and wet/dry defaults.
Create_stereoOnOn = stereo randomized-phase resynthesis; off = mono phase-preserving resynthesis.
Stereo_phase_offset1.00…1. Controls the additional right-channel phase difference relative to the shared base phase field.
Speed_modeFull qualityFull = original rate; Balanced = process at up to 22.05 kHz; Fast = process at up to 11.025 kHz.
Edit_detailsOffOpens all analysis/diffusion parameters after the preset has been loaded.
Draw_visualizationOnDraws the measured terrain, diffusion law, spectral slice and final output.
Play_resultOnPlays the final Sound.

Edit details

ControlMeaning
Effect strengthExpands deviations from each frame's mean linear amplitude. 1 = use the diffused shape as-is; larger values exaggerate peaks/valleys before a positivity clamp.
Wet/dry mixLinear 0…1 blend.
Window size / Time stepGaussian spectrogram analysis geometry. The requested window is rounded up to a power-of-two sample length.
Max frequencyUpper analysis frequency; automatically limited by the working Nyquist frequency.
Frequency resolutionRequested spectrogram frequency sampling.
Dynamic floorLower dB floor used when converting the spectrogram to a log-energy terrain; must be below 0 dB.
Diffusion iterationsNumber of repeated diffusion passes.
Time diffusion / Frequency diffusionSeparate finite-difference step sizes. Internally each is capped at 0.24.
Ridge sensitivity / Edge preservationTogether set κ = ridge_sensitivity / edge_preservation. Higher edge preservation lowers κ and protects ridges more strongly.
Reevaluate edges each iterationRecomputes the gradient field from the evolving terrain each pass.
Random seed0 = a new stereo phase realization; positive integer = repeatable stereo phase realization.

Processing pipeline

  1. Convert multichannel input to mono.
  2. Optionally downsample according to Speed mode.
  3. Build a Gaussian spectrogram and convert it to a dB terrain.
  4. Measure time/frequency gradient magnitude.
  5. Run edge-aware anisotropic diffusion for the requested iterations.
  6. Convert the diffused dB terrain back to linear amplitude.
  7. Expand spectral deviations around each frame's arithmetic mean by Effect strength; clamp negative amplitudes to zero.
  8. Resynthesize by 75%-overlap Hann overlap-add, using the target spectral magnitudes.
  9. Mix wet/dry, trim to source duration, apply 10 ms / 20 ms final fades, restore original sample rate when needed, and target-normalize to 0.95.

Mono / stereo phase model

The magnitude transformation is shared, but the resynthesis phase law depends on output mode.

ModePhase behaviour
MonoPreserves the source-frame complex phase while replacing the magnitude with the diffused target magnitude.
StereoUses a seeded random phase field. Left uses the shared base field; right adds an independent phase-difference term scaled by Stereo_phase_offset. Offset 0 approaches dual mono; offset 1 is widest.
Random seed mainly matters in stereo mode. Mono resynthesis preserves source phase, so the user seed does not alter the magnitude diffusion process itself.

Channels, speed and level

Output name: <source>_BeltramiInspired_<preset>, with _stereo appended in stereo mode.

Visualization

Historical / technical / compositional context

Eugenio Beltrami introduced the Laplace–Beltrami equation in the 1860s as a generalization of Laplace's equation to curved surfaces. The name of this tool points toward that geometric idea: a field whose local geometry determines how smoothing or diffusion should proceed.

The implemented algorithm, however, is technically closer to Pietro Perona and Jitendra Malik's 1990 anisotropic diffusion: smoothing is reduced at strong gradients so edges can survive while flatter regions flow. The optional per-iteration edge reevaluation makes that relationship especially direct.

Compositionally, the script treats a spectrogram as a malleable terrain. Formants, partial ridges and transient edges become topographic features that may resist or permit diffusion. Time diffusion creates memory and smearing; frequency diffusion melts vertical spectral structure; contrast expansion turns the smoothed terrain into a new, often exaggerated resynthesis target. This is best understood as a spectral-morphology instrument, not as a physical simulation of a manifold.

Further reading