Spectrum
A frequency spectrum analyser with axes, a grid and peak hold.
Installation
$ pnpm dlx shadcn@latest add @audiocn/spectrumUsage
import { Spectrum } from "@/components/ui/spectrum";const analyser = useAudioAnalyser(stream, { bands: 64 });
<Spectrum source={analyser.visual} />;The spectrum draws the frequency bands of a visual frame. Set minHz, maxHz, minDb and maxDb to match the analyser that produced them, so the axes are labelled correctly. The defaults match useAudioAnalyser.
Anatomy
<Spectrum>
<SpectrumLevelAxis />
<SpectrumCanvas />
<SpectrumFrequencyAxis />
</Spectrum>Examples
Line and area
Microphone
Theming
| Variable | Default |
|---|---|
--spectrum | primary |
--spectrum-peak | foreground |
--spectrum-grid | border |
API reference
Prop
Type