About this project
Basic Pitch is a Python library for Automatic Music Transcription (AMT) developed by Spotify's Audio Intelligence Lab. It uses a lightweight neural network to convert audio files into MIDI, including pitch bend information. The project is instrument-agnostic and supports polyphonic transcription, though it works best on one instrument at a time.
The library is installable via pip (`pip install basic-pitch`) and also has a sibling TypeScript repository for npm installation. It supports macOS, Windows, and Ubuntu, with Python versions 3.7 through 3.11. On Mac M1 hardware, only Python 3.10 is currently supported.
Basic Pitch ships with multiple model runtime options: the original TensorFlow model plus conversions to CoreML, TensorFlowLite, and ONNX. By default, it selects a runtime based on the platform—CoreML on macOS, TensorFlowLite on Linux, and ONNX on Windows—without installing TensorFlow unless Python 3.11+ is used. Users can install TensorFlow explicitly with `pip install basic-pitch[tf]`.
The library provides both a command-line interface and a programmatic API. The CLI accepts an output directory and one or more input audio paths, and can optionally save sonified MIDI as WAV, raw model outputs as NPZ, and note events as CSV. The programmatic API includes `predict()` for returning model output, MIDI data, and note events, and `predict_and_save()` for orchestrating output generation. For repeated predictions, users can load the model once and pass it to `predict()` to avoid redundant loading.
Supported audio formats include mp3, ogg, wav, flac, and m4a. Stereo input is down-mixed to mono, and all audio is resampled to 22050 Hz. The model can process audio of any length, though very large files may be limited by available disk space.
Basic Pitch was released alongside a research paper presented at ICASSP 2022, titled "A Lightweight Instrument-Agnostic Model for Polyphonic Note Transcription and Multipitch Estimation." A demo is available at basicpitch.io, and a VST version called NeuralNote has been developed by a community member. The project is licensed under Apache 2.0 and welcomes contributions.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.