web synth: port harp + whistle from native (audio engine parity)
Adds two new wave types to the AudioWorklet Synth class so the web
notepat plays the same instruments as the native AC OS:
- harp: Karplus-Strong plucked string. Pre-fills the delay line with
one wavelength of pre-smoothed white noise on note-on, then
per sample reads the delayed sample, applies the canonical
two-point moving-average filter (Karplus & Strong 1983),
multiplies by stretch S (Jaffe-Smith EKS, 0.9985 sustain or
0.990 short-pluck when caller passes small decay), writes
back. Output ×2.5 to match perceived loudness of oscillators.
- whistle: Cook/STK digital waveguide flute. Bore + jet delay lines,
xorshift32 noise (deterministic, matches the C engine), 5 Hz
vibrato LFO, cubic nonlinearity (limit-cycle generator), 1-
pole DC blocker. Same algorithm + coefficients as the C
generate_whistle_sample, just transcribed.
Aliases supported (mirror of parse_wave_type in js-bindings.c):
pluck/guitar/string → harp
ocarina/flute/skullwhistle/skull-whistle → whistle
Updated web disks/notepat.mjs wavetypes (the user-facing wave selector
ring AND the colon-arg whitelist) to expose both. Slot order now:
sine, triangle, sawtooth, square, harp, whistle, composite, stample, drum.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>