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

@audio/synth-osc

v1.1.0

Published

Oscillator — band-limited sine/square/sawtooth/triangle with detune

Readme

@audio/synth-osc npm MIT

Oscillator — band-limited sine/square/saw/triangle, detune, custom wave fn

npm install @audio/synth-osc
import osc from '@audio/synth-osc'

Classic waveform oscillator with cents detune and phase offset, in periodic-function's phase conventions (saw falling, square high on the first half, triangle falling from its peak). Pitched — (freq, opts), the family generator contract.

Square, saw and triangle are band-limited: at each jump in value (saw, square) or slope (triangle) within ±32 samples, the waveform takes the residual of a band-limited step (BLEP; Brandt 2001, Välimäki & Huovilainen 2007) or its integral (BLAMP; Esqueda et al. 2016), a 64-tap Kaiser-windowed sinc (β 10, cutoff 0.47·fs), linear phase, no latency. Measured from 55 Hz to 10 kHz at 44.1 and 48 kHz (2¹⁸-point Blackman-Harris spectra):

| | naive (1.0.x) | band-limited | |---|---|---| | strongest alias below 16 kHz, dB re fundamental (saw) | −54 (55 Hz) to −10 (10 kHz) | under −94 (the analysis floor) | | strongest alias anywhere | −52 to −9 | under −75 | | all aliased power re harmonics | −29 to −5 | −76 to −109 | | harmonics vs the ideal, to 16 kHz | exact, plus aliases | within 0.01 dB; −0.8 dB at 0.45·fs |

wave(type, t, dt) gives one sample of it at phase t advancing dt = f/fs per sample, for oscillators of your own (synth-sfx sweeps its pitch through it).

osc(440, { type: 'sawtooth', detune: -5 })   // → Float32Array

| Param | Default | | |---|---|---| | freq | — | Hz (positional) | | duration | 1 | Seconds | | type | 'sine' | 'sine' | 'square' | 'sawtooth' | 'triangle' | | amp | 0.8 | Peak amplitude | | detune | 0 | Cents | | phase | 0 | Starting phase, 0..1 | | wave | — | Custom waveform fn t => v, overrides type | | fs | 44100 | Sample rate |

Use when: the base oscillator under synth-voice and synth-poly, or any test tone with a classic waveform.


Part of @audio/synth — the synth family umbrella.

MIT © audiojs