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

@youneed/cli-middleware-oscillator

v0.1.0

Published

A synthetic spectrum source + cava-style bar renderer for @youneed/cli: adds this.oscillator and spectrumBars() for terminal audio visualisers.

Readme

@youneed/cli-middleware-oscillator

A synthetic spectrum source and a cava-style bar renderer for @youneed/cli. The middleware adds this.oscillator — a deterministic, dependency-free signal (a sum of sines, bass-biased) whose sample(time) returns per-band magnitudes (0..1) — and spectrumBars() turns those magnitudes into multi-row block bars. It's not a real FFT, it's a stylised visualiser: perfect for a demo, a loading screen, or a music-player UI, and testable because the same time always yields the same frame.

import { Application, Command, task, text } from "@youneed/cli";
import { oscillator, spectrumBars } from "@youneed/cli-middleware-oscillator";

class Vis extends Command("vis", { middleware: [oscillator({ bands: 32, speed: 1.5 })] }) {
  t = 0;

  execute() {
    // animate: bump `t` on a timer and repaint via a task/render loop
    task(this, async () => {
      for (let i = 0; i < 300; i++) {
        this.t = i / 30;
        this.requestUpdate?.();
        await new Promise((r) => setTimeout(r, 33));
      }
    }).run();
  }

  render() {
    return text`${spectrumBars(this.oscillator.sample(this.t), { height: 10 })}`;
  }
}

const app = Application({ name: "demo", commands: [Vis] });
app.run(["vis"]);

Exports

  • oscillator(opts?) — middleware. Contributes this.oscillator, an Oscillator built from createOscillator(opts).
  • createOscillator(opts?) — build a standalone Oscillator (no middleware; handy for tests).
  • spectrumBars(values, opts?) — render an array of 0..1 magnitudes as vertical block bars, top row first, returned as a multi-line string.

Options

  • OscillatorOptions{ bands?, speed? }. bands is the number of columns (default 24); speed is the animation multiplier (default 1).
  • Oscillator{ bands, sample(time) }. sample(time) returns the per-band magnitudes for time in seconds.
  • SpectrumOptions{ height?, color? }. height is the bar height in rows (default 8); color(cell, value, row) transforms each non-blank glyph (e.g. to add ANSI colour).