dettato 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. dettato-2.0.0/CITATION.cff +12 -0
  2. dettato-2.0.0/LICENSE +202 -0
  3. dettato-2.0.0/MANIFEST.in +3 -0
  4. dettato-2.0.0/NOTICE +5 -0
  5. dettato-2.0.0/PKG-INFO +211 -0
  6. dettato-2.0.0/README.md +169 -0
  7. dettato-2.0.0/pyproject.toml +67 -0
  8. dettato-2.0.0/setup.cfg +4 -0
  9. dettato-2.0.0/src/dettato/__init__.py +10 -0
  10. dettato-2.0.0/src/dettato/__main__.py +3 -0
  11. dettato-2.0.0/src/dettato/audio.py +58 -0
  12. dettato-2.0.0/src/dettato/cli.py +62 -0
  13. dettato-2.0.0/src/dettato/drums/__init__.py +6 -0
  14. dettato-2.0.0/src/dettato/drums/features.py +100 -0
  15. dettato-2.0.0/src/dettato/drums/infer.py +142 -0
  16. dettato-2.0.0/src/dettato/drums/model.py +285 -0
  17. dettato-2.0.0/src/dettato/evidence/__init__.py +5 -0
  18. dettato-2.0.0/src/dettato/evidence/features.py +171 -0
  19. dettato-2.0.0/src/dettato/evidence/model.py +302 -0
  20. dettato-2.0.0/src/dettato/evidence/repair.py +171 -0
  21. dettato-2.0.0/src/dettato/grouper/__init__.py +5 -0
  22. dettato-2.0.0/src/dettato/grouper/core.py +308 -0
  23. dettato-2.0.0/src/dettato/grouper/decode.py +268 -0
  24. dettato-2.0.0/src/dettato/grouper/front.py +173 -0
  25. dettato-2.0.0/src/dettato/grouper/instruments.py +102 -0
  26. dettato-2.0.0/src/dettato/grouper/model.py +219 -0
  27. dettato-2.0.0/src/dettato/grouper/retune.py +66 -0
  28. dettato-2.0.0/src/dettato/hub.py +49 -0
  29. dettato-2.0.0/src/dettato/pipeline.py +126 -0
  30. dettato-2.0.0/src/dettato/transcriber/__init__.py +6 -0
  31. dettato-2.0.0/src/dettato/transcriber/core.py +134 -0
  32. dettato-2.0.0/src/dettato/transcriber/decode.py +75 -0
  33. dettato-2.0.0/src/dettato/transcriber/frontend.py +79 -0
  34. dettato-2.0.0/src/dettato/transcriber/model.py +201 -0
  35. dettato-2.0.0/src/dettato.egg-info/PKG-INFO +211 -0
  36. dettato-2.0.0/src/dettato.egg-info/SOURCES.txt +43 -0
  37. dettato-2.0.0/src/dettato.egg-info/dependency_links.txt +1 -0
  38. dettato-2.0.0/src/dettato.egg-info/entry_points.txt +2 -0
  39. dettato-2.0.0/src/dettato.egg-info/requires.txt +11 -0
  40. dettato-2.0.0/src/dettato.egg-info/top_level.txt +1 -0
  41. dettato-2.0.0/tests/conftest.py +29 -0
  42. dettato-2.0.0/tests/test_drums.py +50 -0
  43. dettato-2.0.0/tests/test_evidence.py +20 -0
  44. dettato-2.0.0/tests/test_grouper.py +84 -0
  45. dettato-2.0.0/tests/test_transcriber.py +31 -0
@@ -0,0 +1,12 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use Dettato, please cite it as below."
3
+ title: "Dettato: multi-instrument audio-to-MIDI transcription"
4
+ type: software
5
+ authors:
6
+ - family-names: "Mills"
7
+ given-names: "Nathan"
8
+ repository-code: "https://github.com/kobimusic/dettato"
9
+ url: "https://huggingface.co/kobimusic/dettato"
10
+ license: Apache-2.0
11
+ version: 2.0.0
12
+ date-released: "2026-11-16"
dettato-2.0.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,3 @@
1
+ include CITATION.cff
2
+ graft tests
3
+ global-exclude __pycache__ *.py[cod]
dettato-2.0.0/NOTICE ADDED
@@ -0,0 +1,5 @@
1
+ Dettato
2
+ Copyright 2026 KobiMusic
3
+
4
+ This product includes software and model weights developed by KobiMusic
5
+ (https://github.com/kobimusic/dettato, https://huggingface.co/kobimusic).
dettato-2.0.0/PKG-INFO ADDED
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: dettato
3
+ Version: 2.0.0
4
+ Summary: Multi-instrument audio-to-MIDI transcription: notes, instrument-named tracks and drums from any recording
5
+ Author: Nathan Mills
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/kobimusic/dettato
8
+ Project-URL: Issues, https://github.com/kobimusic/dettato/issues
9
+ Project-URL: Models, https://huggingface.co/collections/kobimusic/dettato
10
+ Project-URL: Benchmark, https://huggingface.co/datasets/kobimusic/dettato-benchmark
11
+ Keywords: music,transcription,music-transcription,automatic-music-transcription,audio-to-midi,midi,drums,multi-instrument,pytorch
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Environment :: GPU :: NVIDIA CUDA
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
25
+ Classifier: Topic :: Multimedia :: Sound/Audio :: MIDI
26
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
27
+ Requires-Python: >=3.10
28
+ Description-Content-Type: text/markdown
29
+ License-File: LICENSE
30
+ License-File: NOTICE
31
+ Requires-Dist: torch>=2.2
32
+ Requires-Dist: numpy>=1.24
33
+ Requires-Dist: scipy>=1.10
34
+ Requires-Dist: soundfile>=0.12
35
+ Requires-Dist: soxr>=0.3
36
+ Requires-Dist: pretty_midi>=0.2.10
37
+ Requires-Dist: huggingface_hub>=0.23
38
+ Requires-Dist: safetensors>=0.4
39
+ Provides-Extra: test
40
+ Requires-Dist: pytest>=7; extra == "test"
41
+ Dynamic: license-file
42
+
43
+ # dettato
44
+
45
+ <p>
46
+ <a href="https://huggingface.co/collections/kobimusic/dettato"><picture>
47
+ <source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/datasets/huggingface/badges/resolve/main/model-on-hf-md-dark.svg">
48
+ <img alt="Model on Hugging Face" src="https://huggingface.co/datasets/huggingface/badges/resolve/main/model-on-hf-md.svg">
49
+ </picture></a>
50
+ <a href="https://huggingface.co/kobimusic"><img alt="Hugging Face: kobimusic" src="https://img.shields.io/badge/Hugging%20Face-kobimusic-FFD21E?logo=huggingface&logoColor=000"></a>
51
+ <a href="https://kobi.music"><img alt="kobi.music" src="https://img.shields.io/badge/web-kobi.music-B73E6A"></a>
52
+ <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-3776AB?logo=python&logoColor=fff">
53
+ </p>
54
+
55
+ KobiMusic's **dettato** is an audio to MIDI transcriber. You give it a recording and it writes a MIDI file, with one track for
56
+ each instrument and a drum track. On nine public benchmark sets it beats MuScriptor 1.3B, which is the next best open model. It
57
+ scores 59.2 composite F1 and MuScriptor scores 45.1. On the three sets that Mirelo publishes, it also scores a bit higher than
58
+ Mirelo A2M v1.1 Pro, which is a closed model (60.8 to 56.1). The part I benchmarked is 20M parameters, and MuScriptor is about 65
59
+ times bigger.
60
+
61
+ dettato is four models in a chain. The transcriber (15.3M parameters) finds the notes. The evidence repairer (4.9M) fixes
62
+ them using the transcriber's evidence. The grouper (2.9M) puts the notes into instrument tracks, and the drum model (5.0M) writes
63
+ the drums. The code and the weights are under Apache-2.0, so commercial use is fine.
64
+
65
+ **No copyrighted recordings.** dettato was trained on a mix of synthetic instrument recordings and CC solo instruments from the
66
+ URMP dataset. The rest of the instruments morph together around 20 soundfonts, using the
67
+ [soundfont babies](https://kobi.music/research/making-soundfont-babies) technique I published. The vocals and the other
68
+ augmentation are CC data too, and the grouper and drum model cards list the CC research datasets they use. No benchmark recording
69
+ was used for training.
70
+
71
+ **What to expect.** It is hard to know how well it will work for your music from benchmarks alone, so I would try it first. The
72
+ weakest step is putting the notes into the instrument tracks they belong in. For instance, on jazz recordings a quarter of the saxophone
73
+ notes can land in the piano track. It also writes performance MIDI. This means the notes keep the timing of the recording, and
74
+ they are not quantized to a beat. If you want something you can play from, like sheet music, I would recommend
75
+ [Songscription](https://www.songscription.ai) or [Klangio](https://klang.io). They are both great tools.
76
+
77
+ ![Composite F1 on all nine benchmark sets, and each system on each set it reports](https://raw.githubusercontent.com/kobimusic/dettato/main/docs/figures/bench_all_sets.png)
78
+
79
+ The benchmark is the eight sets from Table 2 of the MuScriptor paper, plus the Slakh2100 test set. The eight sets are Bach10,
80
+ Dagstuhl ChoirSet, PHENICX-Anechoic, RWC Popular, RWC Classical, RWC Genre, RWC Jazz and RWC Royalty-Free. I scored them with the
81
+ rules from that paper. The composite is the mean of the note onset, note frame, note offset and drum F1.
82
+
83
+ | system | parameters | composite | onset | frame | offset | drums |
84
+ |---|---|---|---|---|---|---|
85
+ | **dettato transcriber + drums** | 20.3M | **59.2** (95% 57.9-60.6) | **67.2** | **77.9** | **44.8** | **47.1** |
86
+ | MuScriptor | 1.3B | 45.1 | 48.6 | 70.2 | 27.8 | 34.0 |
87
+
88
+ Mirelo A2M v1.1 Pro reports three of the sets: PHENICX-Anechoic, RWC Classical and RWC Royalty-Free. On those three, dettato
89
+ scores 60.8. Mirelo A2M scores 56.1 (Mirelo published that number), MuScriptor scores 47.4 and YourMT3+ scores 45.7.
90
+
91
+ ![The three sets Mirelo A2M reports: composite and each measure for dettato, Mirelo A2M, MuScriptor and YourMT3+](https://raw.githubusercontent.com/kobimusic/dettato/main/docs/figures/bench_mirelo_sets.png)
92
+
93
+ On the eight MuScriptor sets alone, dettato scores 58.4. MuScriptor scores 44.6 and YourMT3+ scores 41.1, which are the numbers
94
+ from the paper. The tables for each set are on the [dettato](https://huggingface.co/kobimusic/dettato) and
95
+ [dettato-drums](https://huggingface.co/kobimusic/dettato-drums) cards.
96
+
97
+ The table scores the notes from the transcriber and the hits from the drum model. I measured the evidence repairer alone
98
+ (+0.30 composite with the base network of the transcriber in front). The grouper was measured on my own track benchmark, and their
99
+ cards have the details. I have not scored the four models as one chain yet, the way this package runs them.
100
+
101
+ ## Install
102
+
103
+ ```bash
104
+ pip install git+https://github.com/kobimusic/dettato
105
+ dettato song.mp3 -o out/ # -> out/song.mid + out/song.json
106
+ ```
107
+
108
+ The weights download from the Hugging Face Hub on first use ([the dettato collection](https://huggingface.co/collections/kobimusic/dettato)).
109
+
110
+ ![Beethoven, Symphony No. 5, i.: dettato's MIDI, one lane per instrument track plus timpani](https://raw.githubusercontent.com/kobimusic/dettato/main/docs/figures/example_tracks.png)
111
+
112
+ ## Models
113
+
114
+ Four models, 28.1M parameters in all, collected in the [dettato collection](https://huggingface.co/collections/kobimusic/dettato). Each has its own model card:
115
+
116
+ | stage | model | parameters | what it does |
117
+ |---|---|---|---|
118
+ | 1 | [kobimusic/dettato](https://huggingface.co/kobimusic/dettato) | 15.3M | notes from audio: onset, end and pitch on 88 keys, two voices per key |
119
+ | 2 | [kobimusic/dettato-evidence](https://huggingface.co/kobimusic/dettato-evidence) | 4.9M | repairs the notes using the transcriber's own evidence: drops wrong notes, fixes onsets and ends, adds missed notes |
120
+ | 3 | [kobimusic/dettato-grouper](https://huggingface.co/kobimusic/dettato-grouper) | 2.9M | puts every note in an instrument track and names the instrument |
121
+ | 4 | [kobimusic/dettato-drums](https://huggingface.co/kobimusic/dettato-drums) | 5.0M | drum hits on General MIDI drum keys, drum kits and orchestral percussion |
122
+
123
+ ## Use
124
+
125
+ ### Command line
126
+
127
+ ```bash
128
+ dettato song.mp3 other.wav folder/ -o out/
129
+ ```
130
+
131
+ - Takes any number of files and folders. Folders are searched recursively, and the folder structure is kept under `out/`.
132
+ - Writes `out/<name>.mid` and `out/<name>.json` (the tracks, note counts, the tuning estimate, which drum model ran).
133
+ - Uses the GPU when there is one (`--device cpu` to force the CPU).
134
+
135
+ ### Python
136
+
137
+ ```python
138
+ import dettato
139
+
140
+ result = dettato.transcribe("song.mp3") # loads the models once, then reuses them
141
+ result.save_midi("song.mid")
142
+ for track in result.tracks:
143
+ print(track.name, track.program, track.is_drum, len(track.notes)) # notes: (N, 4) onset s, end s, pitch, velocity
144
+ ```
145
+
146
+ For many files, load once and keep the object:
147
+
148
+ ```python
149
+ from dettato import Dettato
150
+
151
+ model = Dettato.from_pretrained("cuda")
152
+ for path in paths:
153
+ model.transcribe(path).save_midi(path + ".mid")
154
+ ```
155
+
156
+ Each stage can also be used on its own (`dettato.transcriber`, `dettato.evidence`, `dettato.grouper`, `dettato.drums`). The model
157
+ cards show how.
158
+
159
+ ### Weights offline
160
+
161
+ Set `DETTATO_WEIGHTS` to a folder holding the four model repos (`dettato/`, `dettato-evidence/`, `dettato-grouper/`,
162
+ `dettato-drums/`, each with its `config.json` and `model.safetensors`) to load them from disk instead of the Hub.
163
+
164
+ ## How it works
165
+
166
+ ![The pipeline: transcriber, evidence repairer, grouper and drum model](https://raw.githubusercontent.com/kobimusic/dettato/main/docs/figures/pipeline.png)
167
+
168
+ 1. **Transcriber.** A pitch-equivariant lane network reads a harmonic log-frequency spectrogram and gives onset, frame and offset
169
+ probabilities for every key, for two voices per key, at 20 ms. The song is processed in overlapping 8 s windows, and notes come
170
+ from peak picking.
171
+ 2. **Evidence repairer.** A note-level transformer reads each note together with the transcriber's evidence for it (its probability
172
+ maps around the note and its last hidden state) and decides which notes to keep, where they start and end, and which notes are
173
+ missing.
174
+ 3. **Grouper.** The recording's tuning is estimated and corrected, the transcriber's internal features are gathered at every
175
+ repaired note, and a note-level transformer gives each note an instrument and a track embedding. Notes are clustered into
176
+ tracks. A track is kept only when it is clearly its own instrument, and tracks with the same instrument are merged.
177
+ 4. **Drums.** A small drum-kit model and an orchestral-percussion model. A router listens to the whole recording and picks one.
178
+ The drum model needs audio recorded at 40 kHz or more and is skipped for lower-rate sources.
179
+
180
+ ## Requirements
181
+
182
+ - Python 3.10+, PyTorch 2.2+. A CUDA GPU is recommended: on an RTX 5060 (8 GB) a 5-minute song takes about 40 s and peaks under
183
+ 4 GB of GPU memory, which grows with the song's length. The CPU works but is slow (a 15 s clip took 87 s on a laptop CPU,
184
+ model loading included).
185
+ - Audio is read with `soundfile`. Formats it cannot read (m4a / aac, some mp3s) go through `ffmpeg`, which must then be on the PATH.
186
+
187
+ ## Limits
188
+
189
+ - Pitched notes cover the 88 piano keys, with at most two notes on the same key at once.
190
+ - Instrument names are only roughly right: on real jazz about a quarter of a saxophone's or lead guitar's
191
+ notes can land in the piano's track, synth-heavy music is named less reliably, and a concert band gets rough names.
192
+ - No drums for sources recorded below 40 kHz.
193
+
194
+ The example recordings in the figures are in the public domain: Beethoven's Symphony No. 5 and Grieg's Piano Concerto by Musopen
195
+ (via Wikimedia Commons) and *The Stars and Stripes Forever* by the United States Marine Band.
196
+
197
+ ## Licence
198
+
199
+ Code and model weights: Apache-2.0 (see [LICENSE](https://github.com/kobimusic/dettato/blob/main/LICENSE) and [NOTICE](https://github.com/kobimusic/dettato/blob/main/NOTICE)). The model cards list the datasets each model was
200
+ trained with and their licences. Some of the grouper's and the drum model's training datasets carry non-commercial terms.
201
+
202
+ ## Citation
203
+
204
+ ```bibtex
205
+ @software{dettato2026,
206
+ title = {Dettato: multi-instrument audio-to-MIDI transcription},
207
+ author = {Mills, Nathan},
208
+ year = {2026},
209
+ url = {https://github.com/kobimusic/dettato}
210
+ }
211
+ ```
@@ -0,0 +1,169 @@
1
+ # dettato
2
+
3
+ <p>
4
+ <a href="https://huggingface.co/collections/kobimusic/dettato"><picture>
5
+ <source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/datasets/huggingface/badges/resolve/main/model-on-hf-md-dark.svg">
6
+ <img alt="Model on Hugging Face" src="https://huggingface.co/datasets/huggingface/badges/resolve/main/model-on-hf-md.svg">
7
+ </picture></a>
8
+ <a href="https://huggingface.co/kobimusic"><img alt="Hugging Face: kobimusic" src="https://img.shields.io/badge/Hugging%20Face-kobimusic-FFD21E?logo=huggingface&logoColor=000"></a>
9
+ <a href="https://kobi.music"><img alt="kobi.music" src="https://img.shields.io/badge/web-kobi.music-B73E6A"></a>
10
+ <img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-3776AB?logo=python&logoColor=fff">
11
+ </p>
12
+
13
+ KobiMusic's **dettato** is an audio to MIDI transcriber. You give it a recording and it writes a MIDI file, with one track for
14
+ each instrument and a drum track. On nine public benchmark sets it beats MuScriptor 1.3B, which is the next best open model. It
15
+ scores 59.2 composite F1 and MuScriptor scores 45.1. On the three sets that Mirelo publishes, it also scores a bit higher than
16
+ Mirelo A2M v1.1 Pro, which is a closed model (60.8 to 56.1). The part I benchmarked is 20M parameters, and MuScriptor is about 65
17
+ times bigger.
18
+
19
+ dettato is four models in a chain. The transcriber (15.3M parameters) finds the notes. The evidence repairer (4.9M) fixes
20
+ them using the transcriber's evidence. The grouper (2.9M) puts the notes into instrument tracks, and the drum model (5.0M) writes
21
+ the drums. The code and the weights are under Apache-2.0, so commercial use is fine.
22
+
23
+ **No copyrighted recordings.** dettato was trained on a mix of synthetic instrument recordings and CC solo instruments from the
24
+ URMP dataset. The rest of the instruments morph together around 20 soundfonts, using the
25
+ [soundfont babies](https://kobi.music/research/making-soundfont-babies) technique I published. The vocals and the other
26
+ augmentation are CC data too, and the grouper and drum model cards list the CC research datasets they use. No benchmark recording
27
+ was used for training.
28
+
29
+ **What to expect.** It is hard to know how well it will work for your music from benchmarks alone, so I would try it first. The
30
+ weakest step is putting the notes into the instrument tracks they belong in. For instance, on jazz recordings a quarter of the saxophone
31
+ notes can land in the piano track. It also writes performance MIDI. This means the notes keep the timing of the recording, and
32
+ they are not quantized to a beat. If you want something you can play from, like sheet music, I would recommend
33
+ [Songscription](https://www.songscription.ai) or [Klangio](https://klang.io). They are both great tools.
34
+
35
+ ![Composite F1 on all nine benchmark sets, and each system on each set it reports](https://raw.githubusercontent.com/kobimusic/dettato/main/docs/figures/bench_all_sets.png)
36
+
37
+ The benchmark is the eight sets from Table 2 of the MuScriptor paper, plus the Slakh2100 test set. The eight sets are Bach10,
38
+ Dagstuhl ChoirSet, PHENICX-Anechoic, RWC Popular, RWC Classical, RWC Genre, RWC Jazz and RWC Royalty-Free. I scored them with the
39
+ rules from that paper. The composite is the mean of the note onset, note frame, note offset and drum F1.
40
+
41
+ | system | parameters | composite | onset | frame | offset | drums |
42
+ |---|---|---|---|---|---|---|
43
+ | **dettato transcriber + drums** | 20.3M | **59.2** (95% 57.9-60.6) | **67.2** | **77.9** | **44.8** | **47.1** |
44
+ | MuScriptor | 1.3B | 45.1 | 48.6 | 70.2 | 27.8 | 34.0 |
45
+
46
+ Mirelo A2M v1.1 Pro reports three of the sets: PHENICX-Anechoic, RWC Classical and RWC Royalty-Free. On those three, dettato
47
+ scores 60.8. Mirelo A2M scores 56.1 (Mirelo published that number), MuScriptor scores 47.4 and YourMT3+ scores 45.7.
48
+
49
+ ![The three sets Mirelo A2M reports: composite and each measure for dettato, Mirelo A2M, MuScriptor and YourMT3+](https://raw.githubusercontent.com/kobimusic/dettato/main/docs/figures/bench_mirelo_sets.png)
50
+
51
+ On the eight MuScriptor sets alone, dettato scores 58.4. MuScriptor scores 44.6 and YourMT3+ scores 41.1, which are the numbers
52
+ from the paper. The tables for each set are on the [dettato](https://huggingface.co/kobimusic/dettato) and
53
+ [dettato-drums](https://huggingface.co/kobimusic/dettato-drums) cards.
54
+
55
+ The table scores the notes from the transcriber and the hits from the drum model. I measured the evidence repairer alone
56
+ (+0.30 composite with the base network of the transcriber in front). The grouper was measured on my own track benchmark, and their
57
+ cards have the details. I have not scored the four models as one chain yet, the way this package runs them.
58
+
59
+ ## Install
60
+
61
+ ```bash
62
+ pip install git+https://github.com/kobimusic/dettato
63
+ dettato song.mp3 -o out/ # -> out/song.mid + out/song.json
64
+ ```
65
+
66
+ The weights download from the Hugging Face Hub on first use ([the dettato collection](https://huggingface.co/collections/kobimusic/dettato)).
67
+
68
+ ![Beethoven, Symphony No. 5, i.: dettato's MIDI, one lane per instrument track plus timpani](https://raw.githubusercontent.com/kobimusic/dettato/main/docs/figures/example_tracks.png)
69
+
70
+ ## Models
71
+
72
+ Four models, 28.1M parameters in all, collected in the [dettato collection](https://huggingface.co/collections/kobimusic/dettato). Each has its own model card:
73
+
74
+ | stage | model | parameters | what it does |
75
+ |---|---|---|---|
76
+ | 1 | [kobimusic/dettato](https://huggingface.co/kobimusic/dettato) | 15.3M | notes from audio: onset, end and pitch on 88 keys, two voices per key |
77
+ | 2 | [kobimusic/dettato-evidence](https://huggingface.co/kobimusic/dettato-evidence) | 4.9M | repairs the notes using the transcriber's own evidence: drops wrong notes, fixes onsets and ends, adds missed notes |
78
+ | 3 | [kobimusic/dettato-grouper](https://huggingface.co/kobimusic/dettato-grouper) | 2.9M | puts every note in an instrument track and names the instrument |
79
+ | 4 | [kobimusic/dettato-drums](https://huggingface.co/kobimusic/dettato-drums) | 5.0M | drum hits on General MIDI drum keys, drum kits and orchestral percussion |
80
+
81
+ ## Use
82
+
83
+ ### Command line
84
+
85
+ ```bash
86
+ dettato song.mp3 other.wav folder/ -o out/
87
+ ```
88
+
89
+ - Takes any number of files and folders. Folders are searched recursively, and the folder structure is kept under `out/`.
90
+ - Writes `out/<name>.mid` and `out/<name>.json` (the tracks, note counts, the tuning estimate, which drum model ran).
91
+ - Uses the GPU when there is one (`--device cpu` to force the CPU).
92
+
93
+ ### Python
94
+
95
+ ```python
96
+ import dettato
97
+
98
+ result = dettato.transcribe("song.mp3") # loads the models once, then reuses them
99
+ result.save_midi("song.mid")
100
+ for track in result.tracks:
101
+ print(track.name, track.program, track.is_drum, len(track.notes)) # notes: (N, 4) onset s, end s, pitch, velocity
102
+ ```
103
+
104
+ For many files, load once and keep the object:
105
+
106
+ ```python
107
+ from dettato import Dettato
108
+
109
+ model = Dettato.from_pretrained("cuda")
110
+ for path in paths:
111
+ model.transcribe(path).save_midi(path + ".mid")
112
+ ```
113
+
114
+ Each stage can also be used on its own (`dettato.transcriber`, `dettato.evidence`, `dettato.grouper`, `dettato.drums`). The model
115
+ cards show how.
116
+
117
+ ### Weights offline
118
+
119
+ Set `DETTATO_WEIGHTS` to a folder holding the four model repos (`dettato/`, `dettato-evidence/`, `dettato-grouper/`,
120
+ `dettato-drums/`, each with its `config.json` and `model.safetensors`) to load them from disk instead of the Hub.
121
+
122
+ ## How it works
123
+
124
+ ![The pipeline: transcriber, evidence repairer, grouper and drum model](https://raw.githubusercontent.com/kobimusic/dettato/main/docs/figures/pipeline.png)
125
+
126
+ 1. **Transcriber.** A pitch-equivariant lane network reads a harmonic log-frequency spectrogram and gives onset, frame and offset
127
+ probabilities for every key, for two voices per key, at 20 ms. The song is processed in overlapping 8 s windows, and notes come
128
+ from peak picking.
129
+ 2. **Evidence repairer.** A note-level transformer reads each note together with the transcriber's evidence for it (its probability
130
+ maps around the note and its last hidden state) and decides which notes to keep, where they start and end, and which notes are
131
+ missing.
132
+ 3. **Grouper.** The recording's tuning is estimated and corrected, the transcriber's internal features are gathered at every
133
+ repaired note, and a note-level transformer gives each note an instrument and a track embedding. Notes are clustered into
134
+ tracks. A track is kept only when it is clearly its own instrument, and tracks with the same instrument are merged.
135
+ 4. **Drums.** A small drum-kit model and an orchestral-percussion model. A router listens to the whole recording and picks one.
136
+ The drum model needs audio recorded at 40 kHz or more and is skipped for lower-rate sources.
137
+
138
+ ## Requirements
139
+
140
+ - Python 3.10+, PyTorch 2.2+. A CUDA GPU is recommended: on an RTX 5060 (8 GB) a 5-minute song takes about 40 s and peaks under
141
+ 4 GB of GPU memory, which grows with the song's length. The CPU works but is slow (a 15 s clip took 87 s on a laptop CPU,
142
+ model loading included).
143
+ - Audio is read with `soundfile`. Formats it cannot read (m4a / aac, some mp3s) go through `ffmpeg`, which must then be on the PATH.
144
+
145
+ ## Limits
146
+
147
+ - Pitched notes cover the 88 piano keys, with at most two notes on the same key at once.
148
+ - Instrument names are only roughly right: on real jazz about a quarter of a saxophone's or lead guitar's
149
+ notes can land in the piano's track, synth-heavy music is named less reliably, and a concert band gets rough names.
150
+ - No drums for sources recorded below 40 kHz.
151
+
152
+ The example recordings in the figures are in the public domain: Beethoven's Symphony No. 5 and Grieg's Piano Concerto by Musopen
153
+ (via Wikimedia Commons) and *The Stars and Stripes Forever* by the United States Marine Band.
154
+
155
+ ## Licence
156
+
157
+ Code and model weights: Apache-2.0 (see [LICENSE](https://github.com/kobimusic/dettato/blob/main/LICENSE) and [NOTICE](https://github.com/kobimusic/dettato/blob/main/NOTICE)). The model cards list the datasets each model was
158
+ trained with and their licences. Some of the grouper's and the drum model's training datasets carry non-commercial terms.
159
+
160
+ ## Citation
161
+
162
+ ```bibtex
163
+ @software{dettato2026,
164
+ title = {Dettato: multi-instrument audio-to-MIDI transcription},
165
+ author = {Mills, Nathan},
166
+ year = {2026},
167
+ url = {https://github.com/kobimusic/dettato}
168
+ }
169
+ ```