useLevel
Read a meter source into Solid state at a low rate, for labels and conditional UI.
Meters paint every frame without component updates. When you need the level in Solid, for a label or to show a warning, useLevel samples the source a few times a second.
$ pnpm dlx shadcn@latest add @audiocn-solid/use-levelUsage
const level = useLevel(analyser.meter);
return (
<Show when={level.zone === "clip"}>
<p>Turn your microphone down.</p>
</Show>
);Options
Prop
Type
Returns
Prop
Type