Skip to content

Repository files navigation

muscriptor.cpp

Native C++ inference for MuScriptor — transcribe audio to MIDI / note events via ggml (CPU, Apple Metal, or NVIDIA CUDA).

This repository’s code is MIT. Model weights are CC BY-NC 4.0 (non-commercial); accept the license on Hugging Face before downloading.

Install

git clone --recurse-submodules https://github.com/audiohacking/muscriptor.cpp.git
cd muscriptor.cpp
make # Metal on macOS · CUDA if nvcc is available · else CPU
make cpu # or: make metal / make cuda# CUDA tip: export CUDACXX=$(command -v nvcc)

Models

Same sizes as upstream MuScriptor (--model small|medium|large):

SizeParamsLayersDimHF repo
small103M14768muscriptor-small
medium (default)307M241024muscriptor-medium
large1.4B481536muscriptor-large
# 1) Download safetensors (needs `hf` CLI + HF login for gated weights)
pipx install 'huggingface_hub[cli]'
hf auth login
./scripts/download_gguf.sh medium # or small / large# medium also available from the audiohacking bucket:# ./scripts/download_from_bucket.sh# 2) Convert to GGUF (optional Python — convert/ only)
python3 -m venv .venv && ./.venv/bin/pip install -r convert/requirements.txt
./scripts/convert_gguf.sh models/hf-medium models/muscriptor-medium-F16.gguf f16

Transcribe

CLI mirrors the Python muscriptor options:

./build-cuda/muscriptor song.wav -o out.mid
./build-cuda/muscriptor song.wav -m large --instruments piano,drums -o out.mid
./build-cuda/muscriptor song.wav -f jsonl -o events.jsonl
./build-cuda/muscriptor list-instruments
FlagMeaning
-m, --modelsmall / medium / large or path to a .gguf
-d, --deviceauto / cpu / cuda / metal
-o, --outputOutput path (- = stdout)
-f, --formatmidi (default) / json / jsonl
--sampling / -tTemperature sampling
--cfg-coefClassifier-free guidance (keep 1 for released models)
-b, --batch-sizeChunks per step (>1 needs --no-prelude-forcing)
--beam-sizeBeam width (1 = greedy/sampling)
--strict-eosFail if a chunk never emits EOS
--prelude-forcing / --no-prelude-forcingTie prologue across 5 s chunks
--instrumentsComma-separated groups (abbreviations ok)
--notesPrint events to stderr (use with -f json)

About

Native C++ inference for MuScriptor — transcribe audio to MIDI / note events via ggml (CPU, Apple Metal, or NVIDIA CUDA)

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages