A pooled Sound playing a synthesized tone: synthesizeTone and Sound composed, for the common case of a procedural effect that must overlap itself.
Sound
synthesizeTone
import { synthesizeSound } from '@datamoc/mwg/audio';const blip = synthesizeSound({ waveform: 'square', frequency: 660, duration: 0.08 }, { poolSize: 6 });blip.play(1, 0.9 + Math.random() * 0.2); // a little pitch variance per hit Copy
import { synthesizeSound } from '@datamoc/mwg/audio';const blip = synthesizeSound({ waveform: 'square', frequency: 660, duration: 0.08 }, { poolSize: 6 });blip.play(1, 0.9 + Math.random() * 0.2); // a little pitch variance per hit
A pooled
Soundplaying a synthesized tone:synthesizeToneandSoundcomposed, for the common case of a procedural effect that must overlap itself.