How does Web Audio synthesis generate click-free test frequencies?
Inside this browser tone generator and frequency generator, clicking Play tone initializes a local AudioContext that connects an oscillator or noise buffer through smoothed master and channel GainNode stages to a two-channel ChannelMergerNode. An attached AnalyserNode (fftSize 1,024) draws the live waveform while keeping all audio synthesis offline inside your browser tab.
According to the MDN Web AudioContext Documentation, audio graphs stay suspended until a user interaction resumes playback and schedule parameter changes against a sample-accurate currentTime clock. Using native audio clock scheduling avoids JavaScript timer jitter during pitch adjustments and smooth volume slides.
Logarithmic slider scaling and Exact Hz entry
Human hearing perceives pitch logarithmically, so linear sliders cram five octaves between 20 Hz and 640 Hz into the bottom tiny fraction of the track. Frequency (logarithmic scale) instead maps 1,000 slider positions exponentially across 20 Hz to 20,000 Hz, rounding to 0.1 Hz steps below 100 Hz for accurate sub-bass tuning.
For surgical calibration, type directly into Exact Hz or click one of the nine presets (40 Hz, 60 Hz, 100 Hz, 261.6 Hz (C4), 440 Hz (A4), 1,000 Hz, 4,000 Hz, 10,000 Hz, or Pink noise). As the pitch moves, Nearest musical note computes equal-temperament MIDI distance from 440 Hz (A4) and displays tuning offset in cents.
Smoothing live gain and frequency changes
Abrupt changes to gain or frequency mid-wave produce audible zipper noise and speaker pops. Whenever you adjust Output volume (5% to 90%), Exact Hz, or Stereo channel routing while playing, every live AudioParam updates via setTargetAtTime with a 15 ms exponential time constant.
When switching between an oscillator tone and noise, the player automatically restarts the graph cleanly without overlapping sources. Once your frequency targets are dialed in, you can verify left, right, and phase polarity across stereo monitors using dedicated channel wiring presets.
Sine, square, triangle, sawtooth, white noise, and pink noise
Every waveform button changes harmonic density while keeping fundamental pitch or broadband noise level predictable. Under the MDN Web OscillatorNode Reference, browser oscillators output band-limited periodic sine, square, triangle, and sawtooth waveforms directly on the audio rendering thread.
Pure fundamentals vs odd and even harmonics
A Sine wave concentrates 100% of its acoustic energy into a single frequency with zero overtones, making it ideal for hearing checks and subwoofer tuning. Triangle waves add gentle odd harmonics that decay rapidly (1/n^2), producing a mellow flute-like tone for instrument pitch matching.
Square waves contain strong odd harmonics (1/n) with steep edges useful for stressing speaker transients, whereas Sawtooth waves pack both even and odd integer harmonics. Note that while live OscillatorNode playback band-limits harmonics below Nyquist, offline WAV rendering evaluates exact time-domain wave shapes at 48,000 Hz.
White noise vs pink noise spectral balance
White noise uses a deterministic xorshift32 generator (0x9e3779b9) yielding flat energy per linear Hz step, which concentrates perceived loudness in high frequencies. Pink noise feeds that source through a seven-stage Paul Kellet filter rolling off -3 dB per octave so every musical octave shares equal energy.
| Waveform button | Spectral content | Perceived character | Live source node | Primary engineering use |
|---|---|---|---|---|
| Sine | Fundamental frequency only | Smooth, pure whistle | OscillatorNode |
Room modes, tuning (440 Hz), crossover checks |
| Triangle | Soft odd harmonics (1/n^2) |
Warm, flute-like | OscillatorNode |
Instrument intonation and midrange listening |
| Square | Strong odd harmonics (1/n) |
Hollow, buzzy edge | OscillatorNode |
Amplifier clipping headroom and pulse tests |
| Sawtooth | Odd and even harmonics (1/n) |
Bright, brassy buzz | OscillatorNode |
Rich harmonic sweeps and synth comparison |
| White noise | Flat energy per linear Hz |
Crisp, bright hiss | AudioBufferSourceNode |
High-frequency dispersion and acoustic masking |
| Pink noise | -3 dB per octave roll-off |
Balanced waterfall roar | AudioBufferSourceNode |
Studio monitor EQ and octave balance tests |
If you want to capture room acoustic responses from those pink-noise bursts using an external measurement mic, try browser microphone capture in WAV or M4A in another tab. Recording raw mic playback lets you inspect decay behavior offline.
Live oscilloscope inspection and 20 Hz to 20,000 Hz sweeps
Watching the wave shape react in real time confirms waveform transitions, clipping limits, and sweep acceleration visually before audio hits loud studio monitors. Even brief amplitude spikes stand out cleanly on the live trace.
Reading real-time traces with AnalyserNode
Enabling playback attaches an AnalyserNode (fftSize = 1024) ahead of the stereo channel splitter, allowing the oscilloscope canvas to plot floating-point PCM snapshots on each requestAnimationFrame cycle. Using the MDN Web AnalyserNode Reference, getFloatTimeDomainData() reads raw -1.0 to +1.0 values scaled vertically to 42% of canvas height.
Because the analyzer taps the master gain bus before stereo channel muting, the live trace continues showing the synthesized waveform at all times. You still see clean signal motion even when Stereo channel routing isolates Left channel only or flips polarity in Out of phase (L / -R).
Configuring Sweep end frequency (Hz) and playback
Checking Enable frequency sweep reveals Sweep end frequency (Hz) (default 2,000 Hz), allowing automated sweeps anywhere between 20 Hz and 20,000 Hz. Pressing Play tone triggers exponentialRampToValueAtTime across your chosen WAV duration (seconds) (1 to 30 seconds, default 3 seconds) so pitch climbs evenly by musical octave.
If frequencies above 15,000 Hz sound quiet or silent, check sample-rate limits and tweeter dispersion before assuming hardware failure. Adult human hearing sensitivity normally rolls off well below 20,000 Hz, and high-amplitude square waves near Nyquist can fold harsh aliasing products through small laptop speakers; also test USB bus stability alongside 1,000 Hz gaming mice if USB DAC crackles coincide with high USB polling traffic.
Exporting click-free 16-bit WAV audio for offline devices
Clicking Download WAV runs pure TypeScript synthesis inside your tab to generate a stereo RIFF/WAVE file (tone-440hz-sine.wav or tone-sweep-440-2000hz.wav) matching your exact waveform, Stereo channel routing, Output volume, and WAV duration (seconds). Every download writes a 44-byte header followed by 48,000 Hz, 16 bits per sample stereo PCM integers.
To prevent audible pops when audio players loop or start tracks, the synthesizer multiplies the opening and closing 15 ms of every clip by a smooth raised-cosine fade (0.5 * (1 - cos(pi * i / fadeFrames))). Keep Output volume near 45% to 75% when testing tweeters with continuous sine or square waves, because sustained 0 dBFS energy heats delicate voice coils far faster than dynamic music.
Because this tone generator renders every sample locally in JavaScript typed arrays (Float32Array), exports finish instantly with zero network traffic even when Wi-Fi is off. Downloaded 16 bits PCM files play reliably across smart TVs, studio hardware samplers, and car stereos.
Tip: Check mechanical desktop vibrations before diagnosing subtle
40 Hzbuzzes; use the Scroll wheel and encoder test if a loose mouse encoder rattles on your desk during deep bass tones.