Visualizer demo

Visualizer lab.

Render waveform and spectrum canvases as the primary surface with a small pulse control for analyser verification.

Copy-paste

Use this in a React component.

Keep playback inside a user action. The provider creates AudioContext lazily and routes playback through the safe graph.

visualizer.tsx
import {
  AudioProvider,
  SpectrumCanvas,
  WaveformCanvas,
  useTone,
} from "@webaudio-kit/react";

function VisualizerOnly() {
  const tone = useTone({ frequency: 523.25, gain: 0.1, type: "triangle" });

  return (
    <>
      <button onClick={() => void tone.play({ durationMs: 700 })}>
        Pulse visualizer
      </button>
      <WaveformCanvas aria-label="Waveform analyser" />
      <SpectrumCanvas aria-label="Spectrum analyser" />
    </>
  );
}

export function App() {
  return (
    <AudioProvider>
      <VisualizerOnly />
    </AudioProvider>
  );
}
Focused controls

Run the focused surface.

Each page keeps one primary workflow near the snippet, then leaves the full workspace below for broader testing.

Focused live demo

Visualizer-only signal check

idleidle
Pulse analyser routing

Start a short triangle tone and confirm the shared analyser feeds both reusable canvas components.

Full workspace

Try every control together.

Use the shared workspace when you want tone, sweep, noise, test mode, volume, pan, waveform, and spectrum controls on one screen.

Live demo

Play a tone. Sweep a range. Burst noise.

AudioContextidle
Signalidle
Tone generator440 Hz / A4
Analyserwaiting for click
WaveformSpectrum
Frequency sweep250 Hz to 8000 Hz

Uses the current waveform, gain, pan, master volume, and analyser route.

Noise burstwhite

Noise buffers use the same safe routing: source, gain, pan, master volume, analyser, then destination.

Test modeCenter tone

A short low-gain sequence checks center tone, stereo pan, sweep, noise, and analyser routing without making medical claims.

  1. Center tone320ms
  2. Left pan320ms
  3. Right pan320ms
  4. Short sweep700ms
  5. Pink noise450ms