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

@audiorective/devtools

v2.3.2

Published

Dev-time validators for audiorective processors — impulse-based latency measurement

Readme

@audiorective/devtools

Dev-time validators for @audiorective/core processors — impulse-based latency measurement.

This is a dev dependency: install it in devDependencies, never import it from application code. It depends only on @audiorective/core.

In this monorepo, devtools tests exercise @audiorective/core's built dist — run pnpm --filter @audiorective/core build after changing core, or stale-dist failures will look like devtools bugs.

assertLatency

assertLatency sends a single-sample impulse into a processor's input, renders it offline at each configured sample rate, and checks where the impulse arrives at output against the processor's declared latency. Use it as a pin test: write it once against the processor's current declaration, run it, and if it fails, paste the declaration the failure message suggests.

import { assertLatency } from "@audiorective/devtools";
import { MyEffect } from "../src/MyEffect";

it("declares its latency correctly", async () => {
  await assertLatency((ctx) => new MyEffect(ctx));
});

A wrong declaration throws with a message like:

MyEffect latency mismatch
  declared   0
  measured   441 @44100 · 480 @48000   (first arrival; peak 452 · 491)

  Measured latency scales with sample rate — declare it as time:
    latency: Math.round(0.01 * ctx.sampleRate)

or, for a fixed sample count:

  Constant across sample rates — declare it in samples:
    latency: 512

or, when the measured runs fit neither model (including when they simply disagree with each other beyond tolerance):

  Latency fits neither a samples nor a time model; measure by hand.

Paste whichever latency: ... line the failure suggests into the processor's build callback, then rerun the test.

Options

interface MeasureOptions {
  sampleRates?: number[]; // default [44100, 48000]
  channels?: number; // default 2
  windowSeconds?: number; // default 1
  threshold?: number; // default 1e-4
  ready?: (proc: AudioProcessor) => Promise<void>;
}

assertLatency(build, { ...MeasureOptions, tolerance?: number /* default 1 */ });

The processor must be audible in its default state (wet, gated open, etc.) — set that up inside the build factory before returning the processor.

For a worklet-backed processor that is silent until its worklet resolves, pass ready — it's awaited after build returns and before rendering starts.

measureLatency

The lower-level primitive assertLatency is built on. Returns a report instead of throwing:

const report = await measureLatency((ctx) => new MyEffect(ctx));
// { declared: 0, runs: [{ sampleRate: 44100, firstArrival: 441, peak: 452 }, ...] }

Vitest browser-mode config

Both functions render real OfflineAudioContexts, so tests using them need a browser environment, not jsdom. This package's own tests run under headless Chromium via @vitest/browser-playwright:

// vitest.config.ts
import { defineConfig } from "vitest/config";
import { playwright } from "@vitest/browser-playwright";

export default defineConfig({
  test: {
    // Audio tests assert against the AudioContext wall-clock; running test files in
    // parallel browser contexts starves those timers and makes them flaky. Serialize.
    fileParallelism: false,
    browser: {
      enabled: true,
      headless: true,
      provider: playwright({
        launchOptions: {
          args: ["--autoplay-policy=no-user-gesture-required"],
        },
      }),
      instances: [{ browser: "chromium" }],
    },
  },
});