Waveguide Klangmaschine — v2.0 User Guide
Generates a randomised SATB chord using digital waveguide synthesis with per‑string allpass fractional delay, stiffness dispersion, LP damping, and bridge coupling — processed through an 8‑mode soundboard resonator bank, spectral‑split stereo imaging, and a true‑stereo Poisson‑process spectral decay reverb. Each run produces a unique, playable chord with deep three‑layer randomisation.
What this does
Waveguide Klangmaschine is a physical modelling synthesis engine that generates a randomised SATB chord with rich, piano‑like timbre. Each run produces a unique chord by randomising:
- MIDI notes for Bass, Tenor, Alto, Soprano (with configurable ranges).
- Velocity (dynamic force), number of strings per note (1–3), detune amount, body resonance depth.
- Per‑voice onset micro‑delays (0–30 ms) for humanisation.
- Three layers of deep randomisation (controlled by a depth parameter): string character (strike position, damping, stiffness), instrument body (8 resonator frequencies/bandwidths/gains), and excitation physics (hammer amplitude, brightness, contact time).
- Excitation: velocity‑shaped half‑sine pulse with Chaigne‑inspired contact time scaling for high notes.
- String loop: allpass fractional delay → allpass stiffness dispersion → one‑pole LP damping → loop gain.
- Multi‑string unison (1–3 strings with detune + beating).
- Stability‑derived bridge coupling (auto‑safe per note).
- DC blocker on summed string output.
- 8‑resonator soundboard (65–3200 Hz, randomised modes).
- Spectral‑split stereo (LP left / HP right, overlapping).
- Poisson‑process convolution reverb with decorrelated L/R impulse responses.
Quick start
- In Praat, run the script
Waveguide_Klangmaschine.praat(no input selection needed). - Set Duration_s (e.g., 8 seconds).
- Adjust Internal_rate (default 5512.5 Hz – lower = faster, less high frequencies).
- Choose a Randomize_depth:
- None – standard piano waveguide (deterministic, repeatable).
- Subtle – slight per‑voice variation (ensemble character).
- Wild – imaginary instrument space (extreme, experimental).
- Select a Reverb preset (Subtle, Medium, Heavy, Extreme) or Custom.
- Click OK. The script generates a random SATB chord, processes it through the waveguide engine, applies reverb, and creates a stereo Sound object named
Random_Klang_Stereo_spectral_preset.
Physical model architecture
Excitation → Delay line → Fractional delay allpass → Stiffness allpass → One‑pole LP → Loop gain → Feedback
Bridge coupling:
bridge_in = coupling × bridge_prevDC blocker:
y[n] = x[n] - x[n-1] + R × y[n-1] (R = 0.995)
Key components
- Excitation: half‑sine pulse with duration proportional to velocity and inversely proportional to note frequency (Chaigne contact time scaling). Amplitude = velocity^1.5, brightness exponent adjusts spectral tilt.
- Fractional delay: allpass interpolation (
c = (1‑frac)/(1+frac)) for continuous pitch tuning. - Stiffness dispersion: allpass filter (coefficient
stiff_c) simulating the inharmonicity of stiff strings (higher for high notes). - LP damping: one‑pole lowpass (
damp_lp) simulating frequency‑dependent energy loss. - Loop gain: determines decay time; automatically adjusted for stability.
- Bridge coupling: small amount of energy fed back from the summed string output into each string, simulating bridge interaction.
- Soundboard resonators: 8 parallel second‑order filters with centre frequencies, bandwidths, and gains (randomised in Subtle/Wild modes).
Three‑layer randomisation
🎲 Randomization depth control
The Randomize_depth parameter controls three independent layers of variation:
- None (depth=0): Deterministic, repeatable – standard piano waveguide.
- Subtle (depth≈0.3): Slight per‑voice variation – ensemble character (different “instruments” for each voice).
- Wild (depth≈1.0): Extreme variation – imaginary instrument space, from near‑harmonic to bell‑like, bright to dark, short to long contact times.
Layer 1 – Per‑voice string character
Each of the four voices (Bass, Tenor, Alto, Soprano) gets its own:
- Strike position (affects harmonic content).
- LP damping (brightness / darkness).
- Stiffness dispersion (inharmonicity).
- Brightness exponent (spectral tilt of excitation).
- Hammer amplitude (velocity scaling).
- Contact time (pulse width).
At Subtle depth, these vary ±20–30%. At Wild depth, they can vary by factors of 0.3–3.0, creating dramatically different “instruments” per voice.
Layer 2 – Instrument body (soundboard)
The 8 soundboard resonators (65, 130, 210, 340, 560, 950, 1800, 3200 Hz) each have randomised:
- Centre frequency (jittered by ±40% of spread at Wild depth).
- Bandwidth (jittered by ±50%).
- Gain (jittered by ±60%).
At Wild depth, the soundboard becomes a completely different radiating structure each run.
Layer 3 – Excitation physics
Global excitation parameters (hammer amplitude, brightness exponent, contact time) are randomised per run, with the same depth scaling as Layer 1.
Parameters & defaults
Basic synthesis
| Parameter | Range | Default | Description | |||||
|---|---|---|---|---|---|---|---|---|
| Duration_s | any positive | 8.0 | 。||||||
| Internal_rate | 100–22050 | 5512.5 | 。||||||
| Final_rate | any positive | 44100 | 。
Randomisation
Reverb (Spectral Decay)
The reverb section uses the same engine as Spectral_Decay_Reverb.praat – see separate guide for details.
| Parameter | Range | Default | Description | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Preset | Custom / Subtle / Medium / Heavy / Extreme | Medium | 。||||||||||||||||||
| Tail_duration_s | positive | 2.0 | 。||||||||||||||||||
| Impulse_duration_s | positive | 3.0 | 。||||||||||||||||||
| Poisson_density | positive | 2000 | 。||||||||||||||||||
| Decay_base | positive | 110 | 。||||||||||||||||||
| Low_cutoff_Hz / High_cutoff_Hz | positive | 100 / 4000 | 。||||||||||||||||||
| Wet_dry_percent | 0–100 | 50 | 。
Spectral decay reverb (true stereo)
🔊 True‑stereo convolution reverb
The reverb engine generates two decorrelated impulse responses (Poisson process, exponential decay, chirp modulation) – one for the left channel, one for the right. This creates a natural, wide stereo image even with mono input. The reverb is applied after the waveguide synthesis and spectral‑split stereo processing.
Key IR parameters:
- Poisson point process – sparse impulses simulating reflections.
- Exponential decay envelope (
decay_base^(-t/impulse_dur)). - Chirp modulation (
1 + 0.7·sin(2π·t·150 + t·20)) for evolving texture. - Hann bandpass filter to focus reverb on 100–4000 Hz.
The reverb is applied to the final stereo signal after all waveguide processing. The right channel uses slightly different parameters (duration ×0.93, density ×0.95, decay ×0.95, etc.) for decorrelation.
Visualization (Mondrian‑style + reverb panel)
The script draws a two‑panel visualisation:
- Left panel: Mondrian‑style abstract composition driven by note positions. The four coloured rectangles correspond to the four voices (Bass, Tenor, Alto, Soprano), with note labels in the cells. The layout is determined by the MIDI pitch ranges of each voice, creating a unique geometric pattern for every chord.
- Right panel: The reverb visualisation (from the spectral decay reverb script) – shows bandpass filter shape and IR envelope (if reverb preset ≠ Custom, the corresponding panel is drawn).
- Footer: Summary of generated notes, velocity, strings, detune, body resonance, preset, and randomisation depth.
FAQ / troubleshooting
The waveguide model runs a sample‑by‑sample loop at internal_rate (default 5512.5 Hz). For 8 seconds, that’s about 44,000 iterations × 4 voices × up to 3 strings = ~500,000 loop passes. Each pass includes allpass filters, LP filters, and delay line management. This is normal. Reduce Duration_s or increase Internal_rate (lower internal rate = faster but lower high‑frequency content).
The output is normalised to 0.88 peak (dry) and 0.95 after reverb. If clipping occurs, reduce Velocity (not directly adjustable; re‑run to get a lower random velocity) or lower Resonance (body resonance). The script prints the generated velocity in the Info window.
The spectral decay reverb uses a Poisson‑based IR with chirp modulation. If it sounds too ringy, increase Poisson_density (smoother), reduce Decay_base (shorter decay), or lower Wet_dry_percent. For a more natural reverb, try the Subtle preset.
The script randomises notes within fixed ranges:
- Bass: 40–55 (E2–G#3)
- Tenor: 52–64 (E3–E4)
- Alto: 53–72 (F3–C5)
- Soprano: 60–84 (C4–C6)
These can be edited in the script (lines near the top of the voice loop).
The script uses Praat’s randomUniform and randomInteger without a fixed seed. To reproduce a specific chord, note the printed parameters (MIDI notes, velocity, strings, detune, resonance) and manually set them by editing the script (or re‑run until you get the same combination – not guaranteed). Future versions may add a seed parameter.
The waveguide core is adapted from Michele Perrone’s OpenPiano (AGPL‑3.0). The Praat implementation uses the same delay‑line + allpass + LP structure, with additional randomisation layers, soundboard resonators, and spectral‑split stereo.