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

vu-meter-react

v1.0.6

Published

React VU Meter component.

Readme

vu-meter-react

React VU meter component designed to work from legacy React (16.8+) up to React 19. It computes RMS from Web Audio in real time and drives the needle with VU ballistics (~300 ms attack/release). Comes with light/dark themes and responsive sizing.

Demo

CodeSandBox

Installation

When published on npm:

npm i vu-meter-react

Quick start

import { VUMeter } from "vu-meter-react";

// Stereo (L/R)
<VUMeter
  audioContext={audioContext}
  sourceNode={sourceNode}
  referenceLevel={-18}
  options={{ width: 300, theme: "light" }}
/>

// Mono
<VUMeter
  audioContext={audioContext}
  sourceNode={sourceNode}
  mono
  referenceLevel={-20}
  options={{ width: 260, theme: "dark" }}
/>

API

Component

  • VUMeter(props: VUMeterProps)
    • Single component that renders either a single (mono) meter or a stereo pair (L/R)

Types

  • VUMeterProps

    • audioContext: AudioContext | null
    • sourceNode: AudioNode | null
    • mono?: boolean — mono meter when true, stereo when false (default: false)
    • label?: string — mono: "MONO", stereo: "L"/"R" by default
    • referenceLevel?: number — dBFS treated as 0 VU (default: -18)
    • options?: VUMeterOptions
  • VUMeterOptions

    • theme?: 'dark' | 'light' (default: 'light')
    • needleColor?: string
    • labelColor?: string
    • backgroundColor?: string
    • boxColor?: string
    • fontFamily?: string
    • width?: number — height is auto-calculated by aspect ratio when unspecified
    • height?: number — width is auto-calculated by aspect ratio when unspecified
    • peakHoldMs?: number — peak lamp hold time after the last clip in milliseconds (default: 1000)
    • peakFadeMs?: number — peak lamp fade-out duration in milliseconds (default: 5000)
    • clipThresholdDeg?: number — needle angle threshold in degrees to treat as clip (default: 23)

Rendering and metering

  • SVG scale rendering with color accents for warning zones
  • Needle is rotated via CSS transform; tuned for smooth animation
  • Peak lamp turns on near the upper range; once the signal falls below the clip threshold it stays on for peakHoldMs and then fades out over peakFadeMs (defaults: hold 1s, fade 5s)
  • RMS via getFloatTimeDomainData(), converted to dBFS, then mapped to VU with measured piecewise interpolation
  • VU ballistics (~300 ms attack/release) for natural motion

Notes

  • Due to browser autoplay policies, create/resume AudioContext from a user gesture (e.g., clicking Play)
  • In stereo mode, the component internally uses a ChannelSplitterNode to meter L/R

Build / Types / Docs

  • Build (ESM/CJS + d.ts): npm run builddist/index.mjs, dist/index.cjs, dist/index.d.ts
  • Generate docs (TypeDoc): npm run docs → outputs to docs/

License

MIT