useMicrophone
Open a microphone as a MediaStream, with browser processing off by default.
$ pnpm dlx shadcn@latest add @audiocn/use-microphoneUsage
const microphone = useMicrophone({ deviceId });
const analyser = useAudioAnalyser(microphone.stream);
<Button onClick={microphone.start}>Start</Button>;Echo cancellation, noise suppression and automatic gain control are off by default. Browsers turn them on for calls, but they change the level a meter shows. Turn them on when you want call-style audio.
Options
Prop
Type
Returns
Prop
Type