Waveguide & Modal Synthesis — User Guide

Six compact synthesis models: two fractional-delay feedback loops and four explicit modal banks. A shared envelope stage, optional melody demo, reproducible random seed, one final normalization stage, and a process-oriented visualization make the synthesis mechanism directly inspectable.

Author: Shai Cohen Affiliation: Department of Music, Bar-Ilan University, Israel Version: 1.1.2 (2026) License: MIT License Repo: Praat AudioTools
Contents:

What this does

The script generates a new mono Sound; no input Sound is required. The six model choices are deliberately explicit rather than attempts to reproduce complete acoustic instruments.

Waveguide path:
windowed random initial state → compensated fractional delay → two-sample loss averaging → damping feedback → optional continuous breath drive → envelope → short boundary tapers → final normalization

Modal path:
fixed mode-frequency template → damped sinusoidal mode sum → envelope → short boundary tapers → final normalization

The selected Damping control affects the two families differently: in waveguide models it is the loop-feedback multiplier; in modal models it controls a common decay-rate scale applied to every modal template.

Quick start

  1. Choose one of the six synthesis methods.
  2. Leave Melody demo off for one note, or enable it for the built-in eight-note phrase.
  3. For a single note, set Frequency and Duration.
  4. Set Damping and choose one of the ten envelope modes.
  5. Use Edit details for Sample rate, Envelope amount, Output peak, and Random seed.
  6. Run the script. The output is generated offline and optionally visualized and played.
The default method is Modal: Plucked String. The default envelope is No Envelope, but every generated note still receives the script's short anti-click boundary tapers.

Waveguide models

Both waveguide modes use the same fractional-delay feedback structure. The target period in samples is:

Fractional-delay loop

Dtarget = SampleRate / Frequency
Dline = Dtarget - 0.5
N = floor(Dline)
frac = Dline - N

loop[n] = 0.5 × [(1-frac)y[n-N] + y[n-N-1] + frac·y[n-N-2]]

y[n] = Damping × loop[n] + drive[n]

The -0.5-sample compensation offsets the approximate half-sample phase delay contributed by the two-point loss averaging. Fractional interpolation then avoids restricting the pitch to integer delay lengths.

1 — Waveguide: Plucked String

Finite initial excitation Waveguide

The delay line is initialized with random values multiplied by a sin² window across the seed region. After that initial state, drive[n] = 0; the sound evolves only through the damped feedback loop.

2 — Waveguide: Breath-driven Loop

Continuously driven loop Waveguide

The same windowed random initial state is used, but each later sample also receives a small independent random drive:

drive[n] = 0.02 × randomUniform(-1, 1)

This keeps injecting broadband energy into the resonant loop. It is a generic breath-driven feedback model, not a complete pipe or reed simulation.

Envelope shapers

The selected envelope is applied after the waveguide or modal model. Envelope amount affects the parameterized envelopes but does not change the underlying synthesis model.

EnvelopeImplementation
No EnvelopeNo additional envelope multiplication. The universal anti-click note-boundary tapers still apply.
Percussiveexp(-rate·t), where rate = 3 + 8·amount.
Slow Decayexp(-rate·t), where rate = 0.15 + 0.8·amount.
Smooth GateRepeated sin² gate pulses, rate 2 + 10·amount Hz, duty 0.65.
Reverse RampMonotonic half-cosine rise: 0.5 - 0.5 cos(πt/duration).
TremoloRate 4 + 12·amount Hz; depth 0.2 + 0.7·amount; modulation stays non-negative.
Swellsin²(πt/duration): zero at both ends, maximum at the midpoint.
ADSRAttack ≤30 ms, decay ≤150 ms, release ≤200 ms; each is also scaled to short notes. Sustain = 0.45 + 0.40·amount.
Smooth StutterRepeated sin² pulses, rate 6 + 24·amount Hz, duty 0.55.
Random BurstsPoisson events at density 2 + 12·amount events/s. Each event receives a random 0.45–1.0 amplitude and a raised-cosine burst window.

Universal note-boundary taper

After the selected envelope, every note receives a short raised-cosine fade-in and fade-out:

fade duration = min(3 ms, noteDuration / 5)

This is separate from the user-selectable envelope and is always applied.

Melody demo

Melody demo ignores the Single-note Frequency and Duration controls and renders this fixed eight-note sequence with the currently selected model, Damping, Envelope, Details settings, and seed:

FrequencyDuration
261.63 Hz0.4 s
329.63 Hz0.4 s
392.00 Hz0.4 s
523.25 Hz0.6 s
392.00 Hz0.4 s
329.63 Hz0.4 s
261.63 Hz0.4 s
196.00 Hz0.8 s

Total duration is 3.8 s. Every note is generated and tapered separately, the eight Sounds are concatenated, and only then is one final peak normalization applied. There is no per-note normalization.

Controls

Main page

ControlDefaultMeaning
MethodModal: Plucked StringOne of two waveguide or four modal models.
Melody demooffOff = one note; on = fixed 3.8 s eight-note phrase.
Frequency220 HzSingle-note fundamental. Ignored by Melody demo.
Duration2.0 sSingle-note duration. Ignored by Melody demo.
Damping0.998Validated range 0.9–0.9999. Waveguide feedback gain or modal decay-scale control.
EnvelopeNo EnvelopeOne of ten post-model amplitude shapers.
Edit detailsoffOpens sample-rate, envelope amount, output peak, and seed controls.
Draw visualizationonDraws the model/decay/spectral/output diagnostic view.
Play resultonPlays the final normalized Sound.

Details page

ControlDefaultMeaning
Sample rate44100 HzDirect generation rate; accepted range 8000–192000 Hz.
Envelope amount0.30Shared 0…1 depth/rate control used by parameterized envelopes.
Output peak0.95Final target peak normalization; valid >0…1.
Random seed0Positive = initialize Praat's RNG predictably; 0 = do not replace the current RNG state with a fixed seed.

Validation and workload guards

Sample-rate range

8000 Hz ≤ SampleRate ≤ 192000 Hz

Waveguide period guard

For the two waveguide models:

SampleRate / highestFundamental ≥ 4 samples

In Single-note mode, highestFundamental is the requested Frequency. In Melody demo it is 523.25 Hz.

Modal Nyquist guard

For modal methods, the highest template mode must remain below 95% of Nyquist:

highestFundamental × maxModeRatio < 0.95 × Nyquist

The maximum ratios are 6.250 (Bell), 8.080 (Modal Plucked String), 13.344 (Struck Bar), and 2.917 (Circular Membrane).

Single-note workload guard — v1.1.2

Version 1.1.2 adds a render-size limit before Single-note generation:

renderedSamples = round(Duration × SampleRate)
renderedSamples ≤ 5,000,000

If the requested render exceeds this limit, the script stops and reports the maximum permitted Duration for the selected Sample rate. Melody demo is fixed at 3.8 seconds and is not subject to this additional size check.

Randomness and reproducibility

Randomness is used by:

The four modal models are deterministic when a deterministic envelope is selected. Random Bursts makes any model stochastic.

With Random seed > 0, the script initializes Praat's random generator predictably before synthesis. Repeating the same model and settings with the same positive seed reproduces the script's random sequence. With seed 0, the current RNG state is used.

Output and normalization

PropertyBehavior
InputNo input Sound required.
ChannelsMono.
Single-note durationRequested Duration.
Melody duration3.8 s.
Sample rateDetails-page Sample rate.
Single-note name<method_name>_<rounded frequency>Hz.
Melody name<method_name>_melody.
NormalizationOne unconditional target-peak operation on a non-silent final result: Scale peak: OutputPeak.

There is no per-note normalization in Melody demo. The single final gain factor therefore preserves the relative levels created by the model, envelope, and note sequence.

Scale peak is target normalization, not an attenuate-only ceiling. A non-silent result may be raised or lowered to reach the requested Output peak.

Visualization and QC

The visualization compares the model's internal prediction with measurements from the generated Sound. For Melody demo, the first 261.63 Hz / 0.4 s note is used as the representative analysis note; Single-note mode uses the requested note.

Process strip

Waveguide methods show noise excitation → fractional delay → two-sample loss → damping feedback → envelope → output. Modal methods show impulse-like excitation → modal frequency bank → per-mode decay → envelope → summed output.

A — Model structure

B — Predicted decay

C — Expected resonances vs measured spectrum

A Spectrum is measured from the representative generated note. Blue circles show the model template; red stems show measured magnitudes at the corresponding frequencies. Waveguides use the first eight harmonic locations; modal models use their exact ratio sets.

D — Measured output

The final normalized waveform is drawn over the complete output duration.

QC strip

The QC rows report model, representative F0, Sample rate, Damping, Envelope, target waveguide period or modal count/max ratio, Nyquist, and measured final Peak/RMS.