Bar Visualizer
A dynamic audio visualization component for voice agents and media. Supports live media streams or simulated demo states.
Installation
npx raya-ui@latest add bar-visualizerFile Structure
your-project
components
ui
bar-visualizer
BarVisualizer.vue
API Reference
Props
stateAgentStateCurrent interaction state. Accepts 'speaking', 'listening', 'thinking', 'connecting', 'initializing'.
barCountnumber15The total number of vertical bars to render in the visualization.
demobooleanfalseIf true, simulates audio visualization using CSS animations without requiring a real audio stream.
mediaStreamMediaStream | nullnullThe actual Web Audio API stream to hook into for live visualization.
minHeightnumber20The minimum height percentage of the bars when at rest.
maxHeightnumber100The maximum height percentage the bars can reach during peak audio.
Settings
20
20%
100%
source-code.vue
<script setup lang="ts">
import { BarVisualizer } from '@/components/ui/bar-visualizer'
</script>
<template>
<BarVisualizer
state="speaking"
:bar-count="20"
demo
class="w-full h-32 bg-zinc-900 rounded-lg p-4"
/>
</template>