audio/ui
Toggle Mode D
Copy to Clipboardpnpm dlx shadcn@latest add @audio-ui/use-noise-through-eq
Copy to Clipboardimport { useNoiseThroughEq } from "@/hooks/use-noise-through-eq";
| Files | hooks/use-noise-through-eq.ts |
|---|---|
| Depends on | use-play-switch, web-audio |
| npm | Nothing |
| Used by | plot-demo |
| Export | Kind | What it is |
|---|---|---|
useNoiseThroughEq | function | Pink noise played through an equalizer that follows bands, so what a plot draws is what is heard. |
Usage
Pink noise played through an equalizer that follows bands, so what a plot draws is what is heard: the filters play the bands from the moment the noise starts. Returns the analyser after the filters, for a spectrum.
Copy to Clipboardimport { useNoiseThroughEq } from "@/hooks/use-noise-through-eq"; import { useSpectrum } from "@/hooks/use-spectrum"; const { analyser } = useNoiseThroughEq(bands); const spectrum = useSpectrum(analyser);
It plays while the play switch of its session is on, and stops when it goes off or on unmount. A band that comes, goes or changes type rebuilds the chain; a band that moves ramps its filter. The noise is noiseBuffer(ctx, "pink") from device-engine.