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

web-rtttl-synth

v0.1.1

Published

RTTTL parser and Web Audio synth playback library for browsers.

Downloads

19

Readme

RTTTL Web Audio Synth

This started as a fun side project more than 10 years ago, originally used to add a few sound effects to websites. Now it has been revived into a complete TypeScript library with AI assistance, plus a modern Playground that includes a huge built-in RTTTL preset library ready to copy and play. Not sure if anyone will use this project, but I'll publish it just for fun.

Screenshot

Web RTTTL Synth Playground screenshot

Install

npm i web-rtttl-synth

Quick Start (Facade API)

import {playRTTTL} from 'web-rtttl-synth';

const handle = await playRTTTL('Tune:d=4,o=5,b=160:c,e,g,c6', {
    oscillatorType: 'square',
    onStart: ({ bpm, noteCount }) => console.log('start', bpm, noteCount),
    onStop: ({ reason }) => console.log('stopped', reason),
    onEnded: ({ playedCount, totalNotes }) => console.log('done', playedCount, totalNotes),
});

// stop early if needed
handle.stop();

Controller API (Advanced)

import {createSynth} from 'web-rtttl-synth';

const synth = createSynth();
synth.loadRTTTL('Nokia:d=4,o=5,b=180:e,d,f#,g#', {bpmOverride: 180});

const handle = await synth.play({
    oscillatorType: 'triangle',
    onNoteStart: ({ index, playedCount, remainingCount }) => console.log('note start', index, playedCount, remainingCount),
    onNoteEnd: ({ index, playedCount }) => console.log('note end', index, playedCount),
});

await handle.whenEnded;
synth.dispose();

Utility APIs

  • parseRTTTL(text) returns parsed note events.
  • extractRTTTLBpm(text) returns the RTTTL b= value or null.
  • buildPlaybackTimeline(notes, bpm) returns deterministic schedule points in seconds.
  • warmupAudio() pre-warms shared audio context to reduce first-play latency.
import {warmupAudio} from 'web-rtttl-synth';

document.addEventListener('pointerdown', () => {
    void warmupAudio();
}, {once: true});

Options

  • oscillatorType: 'sine' | 'square' | 'sawtooth' | 'triangle' | 'noise'
  • bpmOverride: force BPM instead of RTTTL default.
  • envelope: { attackSeconds, releaseSeconds, peakGain }
  • callbacks: onStart, onStop, onNoteStart, onNoteEnd, onEnded

Browser Notes

  • Requires a browser environment with AudioContext.
  • Playback must be triggered from user interaction in most browsers.

Local Development

npm install
npm run dev        # playground app
npm run build:lib  # ESM + CJS + .d.ts outputs
npm test

Credits

Some preset collections in the Playground were curated and adapted from these community resources:

  • RTTTL parsing reference and inspiration: https://1j01.github.io/rtttl.js/
  • Public ringtone browsing source: https://ringtone.vulc.in/
  • Large ringtone text dataset source: https://microblocks.fun/mbtest/NokringTunes.txt