Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

notepat: fix `pf is not defined` ReferenceError in sample wave blip

playWaveSound("sample") referenced `pf` (pitch factor), a local binding
that only exists inside playZoo / playLaser / playPercussion — not in
playWaveSound's scope. Switching wavetype to "sample" threw a
ReferenceError on the very first synth call, which the error display
surfaced as "act: pf not defined" because the act() handler is what
invokes setWave() → playWaveSound().

The pitch-factor is meaningless for a 30 ms UI-confirmation click, so
drop the multiplication and use the literal 800 Hz tone.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

+5 -2
+5 -2
fedac/native/pieces/notepat.mjs
··· 1961 1961 function playWaveSound(sound, waveType) { 1962 1962 if (!sound?.synth) return; 1963 1963 if (waveType === "sample") { 1964 - // Short percussive click for sample mode 1965 - sound.synth({ type: "noise", tone: 800 * pf, duration: 0.03, volume: 0.12, attack: 0.001, decay: 0.025, pan: 0 }); 1964 + // Short percussive click for sample mode. Previously this referenced 1965 + // `pf` (a local from playZoo/playLaser/playPercussion that never made 1966 + // it into this scope) — throwing a ReferenceError the moment anyone 1967 + // switched wave to "sample". Plain tone is fine for a UI blip. 1968 + sound.synth({ type: "noise", tone: 800, duration: 0.03, volume: 0.12, attack: 0.001, decay: 0.025, pan: 0 }); 1966 1969 return; 1967 1970 } 1968 1971 const tones = { sine: 660, triangle: 550, sawtooth: 440, square: 330, harp: 440, whistle: 880 };