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

@miadi/songbird

v0.1.1

Published

Sing a phrase, keep it as a MIDI take: Songbird's capture chain (save the voice, transcribe it, align it if asked, write the .mid, attach both to a composition), its key and intonation reading, and the piano-roll layout of a take. Browser-first and framew

Readme

@miadi/songbird

Sing a phrase, keep it as a MIDI take. This is Songbird without a framework: the chain that turns a recording into a take, the key and intonation of a take, and the geometry of its piano roll. @miadi/songbird-ui draws the card.

Songbird belongs to the musical composition domain. It authors MIDI from a sung phrase; the capture domain only records what already exists.

The chain

import { runTakeChain, attachTake, httpSongbirdTransport } from "@miadi/songbird"

const take = await runTakeChain(chunks, recorder.mimeType, {
  ext: ".m4a",
  bpm: 92,
  align: true,          // snap to sixteenths at 92 BPM; the sung positions stay in rawNotes
  deferAttach: true,    // judge first, keep after
}, (message, kind) => show(message, kind))

// when the singer says keep (null: nothing was recorded)
if (take) await attachTake(take, "chanson-d-ete", "Chanson d'été", "verse two, softer")
  1. The voice is saved, first and always.
  2. It is transcribed from the saved file.
  3. The notes are aligned to the tempo, only when that was asked before the take began.
  4. The notes are written as a .mid named after the voice (ava8-core's writer), at the take's tempo when it was aligned, otherwise at 120 BPM.
  5. Both are attached to a composition, at once or when the singer keeps the take.

Each step that fails leaves what was already saved and says what is missing. Neither function rejects. attachTake answers how far it got (midiAttached, voiceAttached), so a failed attach stays visible and can be retried. acceptReplacement removes a previous take only after its replacement is attached, and only through the remover the host passes.

The I/O is a SongbirdTransport the host passes as { transport }: importFile, analyze, attachMidi, attachVoice. The default, httpSongbirdTransport(), speaks gmtermux's routes over fetch (/import, /api/nyro/analyze, /api/compositions/<slug>/midi and /clips); a host with other routes or a token names them.

The take, read

| Export | What it answers | |---|---| | keyFromNotes(notes) | The key of a transcription, { key, tonic, mode, confidence }, or null under five hops of evidence. Each note weighs its duration in live-detector hops (HOP_SECONDS), so a take and a live phrase are read with one threshold. | | histogramOfNotes(notes) | The 12-bin pitch-class histogram behind it. | | centsOffPitch(note), centsOff(note) | Cents from the note's equal-tempered center, from its hzMean; 0 when it carries none. | | layoutTake(notes, { width, rawNotes, bpm, aligned }) | The piano roll as geometry: a row per pitch sung (highest on top), a block per note with inTune (within 15 cents), ghosts where alignment moved a note, beat lines when a grid applied. | | noteNameOf(midi) | 69 → A4. |

The browser's half

pickRecorderFormat() asks MediaRecorder for mp4 first (iOS records nothing else), then webm, and answers null where there is no recorder. openMicrophone() asks for the raw microphone, echo cancellation, noise suppression and gain control off, and falls back to plain audio. micErrorMessage(error) says why the microphone failed in words a singer can act on.

The package imports no Node built-in. Browser globals are read only when a function is called.

The live lane

While a phrase is sung, listenToPitch(stream, onNote) reads the microphone every 80 ms and calls onNote each time a new note has held for three reads: the numbers of gmtermux's live lane (#54), with the same YIN tracker the saved take is read with. It answers null where there is no Web Audio, and stop() closes its audio context; the stream's tracks stay the caller's. createNoteSteadier and readLiveNote are the same rule without audio, for a test or another source. @miadi/songbird-ui useLivePitch and LiveNoteLane draw it.