ebnsina

Audio Visualizer

Component

About

A canvas-based audio visualizer that draws real-time bars or a waveform from an audio/video element's playback or a microphone stream. Ported to React from the Sina UI Svelte component by ebnsina (sinaui).

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Audio Visualizer to your project and fits it to your theme.

Code

How Audio Visualizer is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import Visualizer from "@/components/ui/visualizer";
import { useState } from "react";

export default function VisualizerBarsDemo() {
  const [audioEl, setAudioEl] = useState<HTMLAudioElement | null>(null);

  return (
    <div className="grid gap-3 w-full max-w-md">
      <Visualizer source={audioEl} label="Sound levels of Taxim Hicaz" />
      {/* crossOrigin="anonymous": the file's host must allow it, or the visualizer hears silence. */}
      <audio
        ref={setAudioEl}
        controls
        crossOrigin="anonymous"
        preload="metadata"
        className="w-full"
        src="https://cdn.21st.dev/assets/mirror/79/79d62cb6599f1e2f50f7b7a1f71384c6a6eade69ec16cc6c2efecdb1d91f3878.mp3"
      />
    </div>
  );
}

More by ebnsina

View all
  • Countdown Timer

    Countdown Timer

    19
  • Video Player

    Video Player

    15
  • Alarm Clock

    Alarm Clock

    14
  • Voice Note

    Voice Note

    12
  • Split Button

    Split Button

    10
  • Sortable List

    Sortable List

    9
  • Stopwatch

    Stopwatch

    5
  • Code Block

    Code Block

    4