How the Tone Generator Synthesizes Sound
AnyTool Tone Generator is built on the native Web Audio API. A single OscillatorNode (set to the chosen waveform and frequency) feeds a GainNode whose value is moved with linearRampToValueAtTime, so tones fade in and out over a few milliseconds and never click or pop. The signal then passes through a StereoPannerNode that routes it fully left, fully right or centred, before reaching the destination. An AnalyserNode tapped off the gain stage drives a live oscilloscope that draws the actual generated waveform rather than a decorative animation. Frequency, waveform and channel can all change while a tone is playing, and the AudioContext is created lazily on the first user gesture to satisfy browser autoplay policy, then closed on unmount.
- OscillatorNode → GainNode → StereoPannerNode → destination, all native Web Audio
- Gain is ramped with linearRampToValueAtTime to eliminate clicks and pops
- Frequency 20 Hz–20 kHz via a logarithmic slider, exact entry or ±10/±100 Hz steps
- Live oscilloscope is drawn from an AnalyserNode reading the real signal
- AudioContext created lazily on first gesture and closed on unmount — no audio files, no CDN
