npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dafilabs/audio-visualizer

v0.0.6

Published

sync video player with comparison slider could be useful to compare before and after of videos

Readme

Audio Visualizer

ScreenRecording2025-04-07at1 29 40PM-ezgif com-optimize

A React component that creates interactive 3D audio visualizations with Three.js and WebGL shaders.

Overview

This package creates immersive 3D visualizations that respond to audio frequencies in real-time. It features:

  • 3D icosahedron mesh that deforms based on audio frequencies
  • WebGL shader-based animations
  • Interactive camera controls with mouse movement
  • Audio playback controls with timeline
  • Customizable colors and dimensions
  • Bloom post-processing effects

Installation

npm i @dafilabs/audio-visualizer
# or
yarn add @dafilabs/audio-visualizer

Dependencies

This package requires the following dependencies:

  • React
  • Three.js
  • React Hooks (useState, useEffect, useRef)

Basic Usage

import { AudioVisualizer } from 'audio-visualizer-3d';

function App() {
  return (
    <div className="app">
      <h1>Audio Visualizer Demo</h1>
      <AudioVisualizer 
        src="/path/to/audio.mp3"
        width={600}
        height={400}
      />
    </div>
  );
}

export default App;

API Reference

AudioVisualizer Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | src | string | (Required) | Path to the audio file to visualize | | width | number | 400 | Width of the visualizer in pixels | | height | number | 400 | Height of the visualizer in pixels | | uniforms | object | See below | Custom shader uniforms for visualization |

Default uniforms:

{
  u_time: { value: 0.0 },
  u_frequency: { value: 0.0 },
  u_red: { value: 0.61 },
  u_green: { value: 0.61 },
  u_blue: { value: 0.89 }
}

Advanced Configuration

You can customize the appearance by providing custom uniform values:

import { AudioVisualizer } from 'audio-visualizer-3d';

function App() {
  const customUniforms = {
    u_time: { value: 0.0 },
    u_frequency: { value: 0.0 },
    u_red: { value: 0.8 },    // More red
    u_green: { value: 0.3 },  // Less green
    u_blue: { value: 0.9 }    // More blue
  };

  return (
    <AudioVisualizer 
      src="/path/to/audio.mp3"
      width={800}
      height={600}
      uniforms={customUniforms}
    />
  );
}

Under the Hood

The package consists of two main components:

  1. AudioVisualizer - A simplified wrapper component that handles state and default values
  2. AudioVisualizerShader - The core component that integrates Three.js, shaders, and audio analysis

The Visualization Process

  1. Audio is loaded and analyzed using Three.js's AudioAnalyser
  2. Frequency data is passed to shader uniforms
  3. The vertex shader deforms a 3D icosahedron mesh based on Perlin noise and frequency data
  4. The fragment shader applies color based on RGB uniform values
  5. Post-processing adds bloom effects for enhanced visuals
  6. Camera position responds to mouse movement for interactive experience

Shader Details

The visualizer uses two main shaders:

Vertex Shader

Deforms the mesh using Perlin noise techniques, creating dynamic movement based on audio frequency.

Fragment Shader

Applies color to the mesh based on the RGB uniform values provided.

Performance Tips

  • Adjust dimensions for performance on lower-end devices
  • For mobile, consider using smaller dimensions (300x300 or less)
  • Larger audio files may take longer to load and analyze

Troubleshooting

Common Issues

  1. Audio doesn't play on initial load

    • Browser policies often require user interaction before audio can play
    • Add a play button or user interaction trigger
  2. Performance issues

    • Reduce the size of the visualizer
    • Use simpler audio files (smaller size, lower bitrate)
  3. Loading indicator never disappears

    • Check that the audio file path is correct
    • Ensure audio format is supported by the browser

Browser Support

  • Chrome 49+
  • Firefox 45+
  • Safari 12+
  • Edge 79+

WebGL and Web Audio API support required.