Reference

Props, events & methods

The complete component API — every prop, event, exposed method, and slot.

Props

Data source

PropTypeDefaultDescription
mode'websocket' | 'local' | 'external''websocket'Where FFT data comes from
websocketUrlstringWebSocket URL (used when mode="websocket")
dataUint8ArrayExternal FFT magnitudes, mono (mode="external")
dataLeft / dataRightUint8ArrayExternal FFT magnitudes per channel (stereo external mode)
audioSource'mic' | 'display''mic'Local capture source (mode="local")
audioDeviceIdstringSpecific input device for local mic capture
autoReconnectbooleanfalseReconnect the WebSocket with exponential backoff (1s→30s) after an unexpected drop

Data processing

PropTypeDefaultDescription
bands10 | 20 | 40 | 8080Number of frequency bands displayed
noiseFloornumber0Cut magnitudes below this threshold (0–255)
smoothingnumber0Temporal smoothing (0 = none, 0.9 = heavy)
showPeaksbooleantrueShow falling peak indicators
peakDecaynumber0.997Peak fall speed (0.99 = slow, 0.9 = fast)
stereobooleanfalseStereo mode: left channel top, right channel bottom

Appearance

PropTypeDefaultDescription
ledBarsbooleanfalseLED segment effect
ledShape'segment' | 'meter''segment'segment = fixed-pixel gap lines; meter = short, wide segments like a classic LED meter
lumiBarsbooleanfalseFull-height bars whose brightness follows the level
radialbooleanfalseCircular spectrum: angle = frequency, radius = level
radialInnerRadiusnumber0.35Radial: inner hole radius as a fraction of outer radius (0–0.9)
barSpacenumber0.25Gap between bars as a fraction of bar width (0–0.9)
reflexRationumber0Mirrored reflection (0 = off). Linear mono: fraction of height (max 0.7). Radial: > 0 mirrors bars inward
reflexAlphanumber0.25Reflection brightness (0–1)
glownumber0Glow above the bar tops (0 = off, 1 = max)
rotation0 | 90 | 180 | 2700Rotate the whole visual clockwise, in degrees
gradientGradientName | GradientStop[]'classic'Bar colors: a preset name or custom stops
gradientDirection'vertical' | 'horizontal''vertical'Gradient axis
colorMode'gradient' | 'bar-level''gradient'bar-level colors each whole bar by its current level
backgroundstring'#0a0a0a'Background behind/between bars. Any CSS color, incl. 'transparent' / rgba(…) (fixed at mount)
showStatsbooleantrueShow the small connection/fps overlay (overridable via the stats slot)
debugbooleanfalseLog connection/config diagnostics to the console

Events

EventPayloadDescription
connectedData source became active
disconnectedData source stopped
errorstringError message (WS error, capture failure, WebGL init failure)

Exposed methods

Access via a template ref:

<script setup>
import { ref } from 'vue'
const viz = ref()

// Manual connection control
viz.value.connect()
viz.value.disconnect()
viz.value.isConnected            // Ref<boolean>

// Feed FFT frames imperatively (mode="external") — copies the data, so it works
// even when you reuse one buffer each frame (unlike the reference-watched `data` prop)
viz.value.feedData(mono)               // Uint8Array
viz.value.feedData(mono, left, right)  // stereo

// Local-audio device management
await viz.value.getAudioDevices()   // Promise<AudioDevice[]> (prompts for mic permission)
viz.value.audioDevices              // Ref<AudioDevice[]>
viz.value.activeAudioDeviceId       // Ref<string | undefined>
</script>

<template>
  <FFTVisualizer ref="viz" mode="local" />
</template>

Slots

SlotPropsDescription
stats{ connected, bands, fps }Replace the default corner overlay with your own (only rendered when showStats is true)
Copyright © 2026