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

pitch-transcription

v4.4.0

Published

The pitched notes in a recording — Spotify's Basic Pitch model on ONNX Runtime, its readings turned into notes with pitch bends and written as MIDI.

Readme

pitch-transcription

Apache-2.0 licensed NPM version NPM downloads NPM Unpacked Size (with version)

The notes played in a recording: each note's pitch, start, length, loudness and pitch bend, heard by Spotify's Basic Pitch model on ONNX Runtime and written as MIDI if you want a file.

Design notes live in the specs.

Table of Contents


🚀 Getting Started

pnpm i pitch-transcription onnxruntime-common onnxruntime-node
import { InferenceSession } from "onnxruntime-node";
import { fileURLToPath } from "node:url";
import {
  addPitchBends,
  convertNotesToSeconds,
  createNotes,
  MODEL_URL,
  readModel,
  writeMidi,
} from "pitch-transcription";

// Under Node, the session reads the shipped model file; in a browser, `InferenceSession.create(servedModelUrl)` from `onnxruntime-web` instead
const session = await InferenceSession.create(fileURLToPath(MODEL_URL));
// One channel at 22050 Hz as a Float32Array, or an AudioBuffer at 22050 Hz with any number of channels
const readings = await readModel(session, samples, (_windowReadings, progress) => console.log(progress));
const notes = createNotes(readings, { minNoteLength: 11 });
const bentNotes = addPitchBends(readings.contours, notes);
const timedNotes = convertNotesToSeconds(bentNotes);
// Each note's startTimeSeconds, durationSeconds, pitchMidi, amplitude and pitchBends
const midiBytes = writeMidi(timedNotes);
await session.release();

A worker or a server that already holds the readings imports note creation from pitch-transcription/notes, which never loads ONNX Runtime.

pitch-transcription takes onnxruntime-common as a peer; the runtime the session runs on is yours to choose, onnxruntime-node under Node or onnxruntime-web in a browser.

🧩 Key Exports

| Export | Kind | Purpose | | :---------------------- | :------- | :----------------------------------------------------------------------------------------------------------------- | | addPitchBends | function | Each note's bend at every frame, in contour bins of a third of a semitone | | convertNotesToSeconds | function | Notes timed in seconds rather than the model's frames | | createNotes | function | The readings turned into notes, with Basic Pitch's thresholds, inferred onsets, frequency range and melodia trick | | MODEL_URL | const | The shipped model file, Basic Pitch's ONNX export | | readModel | function | The model's frame, onset and contour readings over a recording, a window at a time, each output disposed once read | | writeMidi | function | Notes as a MIDI file's bytes, each bend written as its share of the bend's range |

⚖️ License

This project is licensed under the Apache-2.0 license. It is derived from basic-pitch-ts, Copyright 2022 Spotify AB, and ships its trained model unmodified, both under the Apache-2.0 license; see NOTICE.