Pitch demo
Pitch helper.
Use frequency clamping and note-name helpers next to playback so pitch UI stays readable.
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.
pitch.tsx
import {
AudioProvider,
clampFrequency,
frequencyToNoteName,
useTone,
} from "@webaudio-kit/react";
function PitchHelperDemo({ frequency = 440 }) {
const safeFrequency = clampFrequency(frequency);
const tone = useTone({ frequency: safeFrequency, gain: 0.12 });
return (
<>
<span>{frequencyToNoteName(safeFrequency)}</span>
<button onClick={() => void tone.play({ durationMs: 700 })}>
Play pitch
</button>
</>
);
}
export function App() {
return (
<AudioProvider>
<PitchHelperDemo />
</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
Pitch helper playback
idleidle
NoteA4
Frequency440 Hz
Gain0.126
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
WaveformSpectrumFrequency 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.
- Center tone320ms
- Left pan320ms
- Right pan320ms
- Short sweep700ms
- Pink noise450ms