Master volume.
Expose provider master gain as a bounded UI control and play a reference tone through that shared gain.
Use this in a React component.
Keep playback inside a user action. The provider creates AudioContext lazily and routes playback through the safe graph.
import { AudioProvider, useTone, useVolume } from "@webaudio-kit/react";
function MasterVolumeDemo() {
const volume = useVolume();
const tone = useTone({ frequency: 440, gain: 0.12 });
return (
<>
<input
max={0.5}
min={0}
onChange={(event) => void volume.setGain(event.currentTarget.valueAsNumber)}
step={0.01}
type="range"
value={volume.gain}
/>
<button onClick={() => void tone.play({ durationMs: 700 })}>
Play volume reference
</button>
</>
);
}
export function App() {
return (
<AudioProvider>
<MasterVolumeDemo />
</AudioProvider>
);
}Run the focused surface.
Each page keeps one primary workflow near the snippet, then leaves the full workspace below for broader testing.
Bounded master gain control
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.
Play a tone. Sweep a range. Burst noise.
Uses the current waveform, gain, pan, master volume, and analyser route.
Noise buffers use the same safe routing: source, gain, pan, master volume, analyser, then destination.
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