Audio Visualizer
Live audio level as bars, a waveform or an orb: the mic meter of a call, a voice message, a voice assistant.
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
variant | AudioVisualizerVariant | bars | bars, wave or orb. |
bars | number | 5 | Number of bars. |
level | number | undefined | — | A level from 0 to 1, for an app that has it from its call SDK. stream and media win over it. |
state | AudioVisualizerState | idle | What to animate when there is no source. |
muted | boolean | false | A muted source: a flat, greyed meter. |
speaking-threshold | number | 0.08 | Level from which the source counts as speaking. |
label | string | — | Makes the visualizer an image of this name, for one that stands on its own. Decorative without it. |
Events
| Name | Type | Description |
|---|---|---|
speaking-change | CustomEvent<{ speaking: boolean }> | Fired when the source starts or stops speaking. Does not bubble. |
CSS parts
Shadow DOM styling hooks used with ::part(name). Prefer CSS custom properties when they cover the change.
| Name | Description |
|---|---|
bar | Each bar. |
wave | The waveform's SVG. |
orb | The orb. |
CSS custom properties
Grouped by semantic target and state from --c2-<component>__<target>__<state>--<property>. Click a group to collapse it; click a name to copy it.
| Name | Type | Default | Description |
|---|---|---|---|
--c2-audio-visualizer--height | pixel | 32px | Height of the bars and the waveform. |
--c2-audio-visualizer__wave--width | pixel | 240px | |
--c2-audio-visualizer__wave--color | color | rgb(2, 101, 220) | |
--c2-audio-visualizer__wave--stroke-width | pixel | 2px | |
--c2-audio-visualizer__bar--color | color | rgb(2, 101, 220) | |
--c2-audio-visualizer__bar--width | pixel | 4px | |
--c2-audio-visualizer__bar--gap | pixel | 3px | |
--c2-audio-visualizer__bar--min-height | pixel | 4px | Height of a silent bar. |
--c2-audio-visualizer__bar--border-radius | border-radius | 999px | |
--c2-audio-visualizer__orb--size | pixel | 96px | |
--c2-audio-visualizer__orb--color | color | rgb(2, 101, 220) | The orb's body; its highlight and shade are mixed from it. |
--c2-audio-visualizer__orb--glow | pixel | 32px | The glow at full level. |
--c2-audio-visualizer__muted--color | color | #a1a1aa | The bars, wave or orb of a muted source. |