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

sonicperf

v1.0.0

Published

Performance toolkit for audio-reactive web apps. FPS throttling, lazy audio loading, Web Audio API resource management and visibility auto-pause.

Downloads

104

Readme

⚡ SonicPerf

Performance Optimization Utilities for Audio-Reactive Web Apps

npm bundle size npm version License: MIT

SonicPerf is a JavaScript performance toolkit designed for audio-reactive web applications. It provides lazy loading, FPS-capped animation throttling, resource management, and visibility-based auto pause/resume — ensuring your music-driven web experiences run at peak efficiency even on low-end devices.

Zero dependencies. Plug directly into any audio-reactive setup.


✨ Features

  • 🦥 Lazy Loader: Load audio files and heavy resources only when needed — reduce initial page weight.
  • 🎛️ Animation Throttler: Cap your animation loop to a target FPS (e.g., 30fps on mobile) to save battery and CPU.
  • 🧹 Resource Manager: Track and release AudioContext, AudioBuffer, and Web Audio API nodes automatically.
  • 👁️ Visibility Manager: Auto-pause animations and audio when the browser tab is hidden, auto-resume on return.

💻 Installation

npm install sonicperf
import SonicPerf from 'sonicperf';

🚀 Quick Start

Animation Throttler (Limit FPS)

import SonicPerf from 'sonicperf';

const throttler = SonicPerf.createThrottler({ targetFPS: 30 });

throttler.start((timestamp) => {
    // Your audio-reactive animation loop here
    // Will only fire ~30 times per second, not 60+
    updateVisuals(audioData);
});

// To stop
throttler.stop();

Lazy Loader (Load on Demand)

const loader = SonicPerf.createLazyLoader();

// Load audio stems only when user clicks Play
const stems = await loader.loadAll({
    kick: '/audio/kick.mp3',
    bass: '/audio/bass.mp3',
    vocals: '/audio/vocals.mp3'
});

Visibility Manager (Auto Pause/Resume)

const visManager = SonicPerf.createVisibilityManager();

visManager.onHidden(() => sonic.pause());   // Pause when tab hidden
visManager.onVisible(() => sonic.play());   // Resume on return
visManager.start();

Resource Manager (Auto Cleanup)

const resources = SonicPerf.createResourceManager();

// Register resources to be tracked
resources.register('myContext', audioContext);
resources.register('myBuffer', audioBuffer);

// Release all when done
resources.destroyAll();

📐 API Reference

SonicPerf.createThrottler(config?)

| Option | Default | Description | |---|---|---| | targetFPS | 60 | Maximum frames per second | | useIdleCallback | false | Use requestIdleCallback for low-priority work | | idleTimeout | 50 | Idle callback timeout (ms) |

SonicPerf.createLazyLoader()

const loader = SonicPerf.createLazyLoader();
await loader.load('kick', '/audio/kick.mp3');       // Single file
await loader.loadAll({ kick: '...', bass: '...' }); // Multiple files
loader.get('kick');                                  // Get loaded buffer

SonicPerf.createVisibilityManager()

const vm = SonicPerf.createVisibilityManager();
vm.onHidden(callback);   // Called when tab goes hidden
vm.onVisible(callback);  // Called when tab becomes visible
vm.start();              // Begin listening
vm.stop();               // Stop listening

SonicPerf.createResourceManager()

const rm = SonicPerf.createResourceManager();
rm.register(key, resource);  // Track a resource
rm.get(key);                 // Retrieve a resource
rm.release(key);             // Release one resource
rm.destroyAll();             // Release all resources

🎵 Works Best With

  • sonicmotion — Audio stem analysis and DOM animation engine
  • sonicfx — Advanced audio-reactive visual effects
  • sonicscroll — Scroll-triggered animations with audio-aware mode
  • sonicwave — Canvas waveform and spectrum visualizations

📄 License

MIT © 2025 axscq