File size: 8,567 Bytes
0f42775 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | ---
license: cc-by-nc-4.0
library_name: muscriptor
tags:
- music
- music-transcription
- automatic-music-transcription
- amt
- audio-to-midi
- midi
- music-information-retrieval
- transformer
- pytorch
---
# MuScriptor β medium (β300M)
**MuScriptor** is an open-weight model for **general-purpose, multi-instrument automatic music transcription (AMT)**: it converts a music recording (any genre, multiple simultaneous instruments) into a stream of notes played. This repository hosts the **medium** variant (β300M parameters), the default checkpoint downloaded by the `muscriptor` library.
`muscriptor-medium` balances quality and footprint. For the best transcription quality use [`muscriptor-large`](https://huggingface.co/MuScriptor/muscriptor-large) (β1.3B); for the smallest/fastest option use [`muscriptor-small`](https://huggingface.co/MuScriptor/muscriptor-small) (β100M).
- Developed by [Mirelo](https://www.mirelo.ai/) x [kyutai](https://kyutai.org/)
- π Paper: *MuScriptor: An Open Model for Multi-Instrument Music Transcription* β Rouard, Krause, Roebel, Simon-Gabriel, DΓ©fossez (2026). _<!-- TODO: add arXiv link once public; it will auto-cross-link on the Hub -->_
- π» Code: <https://github.com/muscriptor/muscriptor>
- π Audio samples: <https://muscriptor.github.io>
## Table of contents
- [Quickstart](#quickstart)
- [Model description](#model-description)
- [Model variants](#model-variants)
- [Intended uses & limitations](#intended-uses--limitations)
- [Instrument conditioning](#instrument-conditioning)
- [Training](#training)
- [Evaluation](#evaluation)
- [Citation](#citation)
- [License](#license)
## Quickstart
Install the `muscriptor` package (it uses `huggingface_hub` to fetch weights automatically):
```bash
pip install git+https://github.com/muscriptor/muscriptor.git
# TODO (PyPI release forthcoming: pip install muscriptor)
```
### Python
```python
from pathlib import Path
from muscriptor import TranscriptionModel
# "medium" resolves to hf://MuScriptor/muscriptor-medium and downloads on first use.
model = TranscriptionModel.load_model("medium")
# Get a MIDI file directly:
Path("out.mid").write_bytes(model.transcribe_to_midi("audio.wav"))
# Or stream note events as they are transcribed:
for event in model.transcribe("audio.wav"):
print(event) # NoteStartEvent / NoteEndEvent / ProgressEvent
```
`load_model` accepts a size keyword (`"small"`/`"medium"`/`"large"`), a local `.safetensors` path, or an `hf://` / `https://` URL. Weights loaded by size keyword (or any `hf://` URL) are cached in the standard Hugging Face cache (`~/.cache/huggingface/hub`, configurable via `HF_HOME`); weights fetched from a plain `http(s)://` URL are cached under `~/.cache/muscriptor/`. Input audio can be WAV or any format `libsndfile` reads (mp3, flac, ogg, m4a, β¦); it is resampled to 16 kHz mono internally.
### CLI
```bash
muscriptor transcribe --model medium audio.wav -o out.mid
```
## Model description
MuScriptor performs transcription by **autoregressively predicting a MIDI-like token sequence** given the mel-spectrogram of a short audio segment, following the sequence-to-sequence AMT paradigm (cf. MT3). It deliberately avoids complex architectural tweaks in favor of a simple, decoder-only Transformer.
- **Architecture:** decoder-only Transformer (this variant: `dim=1024`, `num_heads=16`, `num_layers=24`).
- **Input:** raw waveform (16 kHz, mono) of a 5-second segment β mel-spectrogram (STFT `n_fft=2048`, hop 160 β 100 Hz frame rate, 512 mel bins). The spectrogram is projected to the model dimension and used as a prefix condition.
- **Output tokenization:** MT3-like note events; the 128 MIDI programs are mapped to **36 instrument subgroups** using the `MT3_FULL_PLUS` taxonomy. Decoding is greedy (argmax) by default, with optional classifier-free guidance (CFG).
- **Inference:** audio is processed in 5-second chunks; note events are emitted in temporal order. Optional **instrument conditioning** stabilizes predictions across chunk boundaries and lets you restrict/customize the transcription (see below).
**Note on the representation:** the tokenizer recovers onset/offset timing, pitch, and instrument, but **not velocity**. It also cannot represent two notes of the same pitch and instrument sounding at the same time. Drums are onset-only.
## Model variants
| Repo | Params | `dim` | heads | layers | Notes |
|---|---|---|---|---|---|
| [`muscriptor-small`](https://huggingface.co/MuScriptor/muscriptor-small) | β100M | 768 | 12 | 14 | smallest / fastest |
| [`muscriptor-medium`](https://huggingface.co/MuScriptor/muscriptor-medium) | β300M | 1024 | 16 | 24 | **this model** Β· good trade-off |
| [`muscriptor-large`](https://huggingface.co/MuScriptor/muscriptor-large) | β1.3B | 1536 | 24 | 48 | best quality |
All variants share the same input pipeline, tokenizer, and training recipe; they differ only in latent dimension, attention heads, and depth.
## Intended uses & limitations
**Intended uses**
- General-purpose transcription of real, multi-instrument music across genres (classical β heavy metal) into MIDI.
- A building block for music information retrieval (chord/key recognition), musicological analysis, generative-modeling data pipelines, and tools for musicians.
**Out of scope / use with care**
- Not a substitute for a hand-annotated score; expect errors, especially on dense mixes, unusual timbres, and heavily processed audio.
- Velocity/dynamics are **not** produced (see note above).
- Onset/offset precision is lower for some styles (e.g. choral music), and exact offsets are inherently harder than onsets.
**Limitations & biases**
- Training data skews toward pop and Western classical music, and the instrument distribution is long-tailed (piano/guitar/bass/drums are most frequent). Rare instruments and underrepresented genres may be transcribed less reliably.
- The fixed `MT3_FULL_PLUS` 36-group instrument taxonomy limits instrument granularity.
- Simultaneous same-pitch/same-instrument notes cannot be represented by the tokenizer.
## Instrument conditioning
The model can be told which instrument groups are present in the track. Supplying the correct set improves quantitative scores and produces more coherent instrument assignments across segments.
```python
from muscriptor.tokenizer.mt3 import MT3_FULL_PLUS_GROUP_NAMES
# `instrument_group` is a space-separated string of MT3_FULL_PLUS group IDs.
# Convert readable group names to IDs:
names = ["acoustic_piano", "acoustic_guitar", "acoustic_bass"]
instrument_group = " ".join(str(MT3_FULL_PLUS_GROUP_NAMES[n]) for n in names) # -> "0 4 7"
# Only expect piano, acoustic guitar and bass in this track:
model.transcribe_to_midi("audio.wav", instrument_group=instrument_group)
```
```bash
muscriptor transcribe --model medium --instruments "acoustic_piano,acoustic_guitar,acoustic_bass" audio.wav -o out.mid
muscriptor list-instruments # show all available group names
```
## Evaluation
Metrics are instrument-agnostic F1 scores computed with [`mir_eval`](https://github.com/craffel/mir_eval) on `D_Test`, the authors' held-out test set of 372 multi-instrument tracks.
**Model-size comparison** (F1 β; from the paper's scaling study, models trained on `D_Real` only, CFG = 2):
| Variant | Params | Onset | Frame | Offset | Drums | Multi |
|---|---|---|---|---|---|---|
| `muscriptor-small` | 100M | 51.2 | 67.2 | 38.7 | 41.5 | 38.2 |
| **`muscriptor-medium`** | **300M** | **52.4** | **68.0** | **40.3** | **42.0** | **39.7** |
| `muscriptor-large` | 1.3B | 53.2 | 68.7 | 41.0 | 42.5 | 40.5 |
These numbers come from the model-size ablation, which trains on real audio **only**. The **released checkpoints additionally use synthetic pre-training and RL post-training**, which improve real-world quality substantially beyond these figures. See [`muscriptor-large`](https://huggingface.co/MuScriptor/muscriptor-large) and the paper for per-dataset results.
## Citation
```bibtex
@inproceedings{muscriptor2026,
title = {MuScriptor: An Open Model for Multi-Instrument Music Transcription},
author = {Rouard, Simon and Krause, Michael and Roebel, Axel and
Simon-Gabriel, Carl-Johann and D{\'e}fossez, Alexandre},
year = {2026},
note = {Kyutai, Mirelo AI, IRCAM}
}
```
<!-- TODO: replace with the final published citation (venue / arXiv id) once available. -->
## License
Code released under the [MIT License](https://github.com/muscriptor/muscriptor/blob/main/LICENSE). Weights released under CC-BY-NC.
|