Night 10.11.2026: m-a-p/SheetSage2 (the transcriber as m-a-p publishes it), unchanged (CC BY-NC 4.0), at the Studio's own path; its lines in MANIFEST.tsv, SHA256SUMS, THIRD_PARTY_NOTICES.md and the card
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- .gitattributes+2
- MANIFEST.tsv+133
- README.md+1
- SHA256SUMS+133
- THIRD_PARTY_NOTICES.md+17
- checkpoints/SheetSage2/LICENSEAdded+424
- checkpoints/SheetSage2/THIRD_PARTY_NOTICES.mdAdded+8
- checkpoints/SheetSage2/__init__.pyAdded+1
- checkpoints/SheetSage2/assets/architecture.pngAdded
- checkpoints/SheetSage2/audio_sheetsage2.pyAdded+92
- checkpoints/SheetSage2/benchmarks/chordformer.mdAdded+62
- checkpoints/SheetSage2/benchmarks/chordformer_per_song.csvAdded
- checkpoints/SheetSage2/benchmarks/chordformer_results.jsonAdded+101
- checkpoints/SheetSage2/benchmarks/rock_corpus.mdAdded+33
- checkpoints/SheetSage2/benchmarks/rock_corpus_per_song.csvAdded+401
- checkpoints/SheetSage2/benchmarks/rock_corpus_results.jsonAdded+37
- checkpoints/SheetSage2/benchmarks/score_chordformer.pyAdded+122
- checkpoints/SheetSage2/chord_spelling_sheetsage2.pyAdded+196
- checkpoints/SheetSage2/config.jsonAdded+75
- checkpoints/SheetSage2/configuration_mert2.pyAdded+76
- checkpoints/SheetSage2/configuration_sheetsage2.pyAdded+88
- checkpoints/SheetSage2/durations_sheetsage2.pyAdded+14
- checkpoints/SheetSage2/exports_sheetsage2.pyAdded+209
- checkpoints/SheetSage2/generation_sheetsage2.pyAdded+634
- checkpoints/SheetSage2/infer.pyAdded+78
- checkpoints/SheetSage2/io_sheetsage2.pyAdded+67
- checkpoints/SheetSage2/labels_sheetsage2.pyAdded+29
- checkpoints/SheetSage2/midi_sheetsage2.pyAdded+92
- checkpoints/SheetSage2/model.safetensorsAdded+3
- checkpoints/SheetSage2/modeling_mert2.pyAdded+361
- checkpoints/SheetSage2/notation_sheetsage2.pyAdded+1570
- checkpoints/SheetSage2/pipeline_sheetsage2.pyAdded+259
- checkpoints/SheetSage2/processor_config.jsonAdded+11
- checkpoints/SheetSage2/render.pyAdded+45
- checkpoints/SheetSage2/render_assets/DejaVuSans.ttfAdded+3
- checkpoints/SheetSage2/render_assets/LICENSE.abcjsAdded+21
- checkpoints/SheetSage2/render_assets/LICENSE.fontAdded+187
- checkpoints/SheetSage2/render_assets/abcjs-basic-min.jsAdded
- checkpoints/SheetSage2/render_assets/manifest.jsonAdded+106
- checkpoints/SheetSage2/render_assets/renderer.jsAdded+165
- checkpoints/SheetSage2/render_assets/soundfonts/ATTRIBUTION.mdAdded+11
- checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A0.mp3Added
- checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A1.mp3Added
- checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A2.mp3Added
- checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A3.mp3Added
- checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A4.mp3Added
- checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A5.mp3Added
- checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A6.mp3Added
- checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A7.mp3Added
- checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab1.mp3Added
102 unmodified lines103104105102 unmodified linescheckpoints/YuE2-Vae-legacy/assets/architecture.png filter=lfs diff=lfs merge=lfs -textcheckpoints/YuE2-Vae-legacy/assets/figure1.png filter=lfs diff=lfs merge=lfs -textcheckpoints/MERT-v2-30s/assets/mert2-architecture.png filter=lfs diff=lfs merge=lfs -text102 unmodified lines103104105106107102 unmodified linescheckpoints/YuE2-Vae-legacy/assets/architecture.png filter=lfs diff=lfs merge=lfs -textcheckpoints/YuE2-Vae-legacy/assets/figure1.png filter=lfs diff=lfs merge=lfs -textcheckpoints/MERT-v2-30s/assets/mert2-architecture.png filter=lfs diff=lfs merge=lfs -textcheckpoints/SheetSage2/assets/architecture.png filter=lfs diff=lfs merge=lfs -textcheckpoints/SheetSage2/render_assets/DejaVuSans.ttf filter=lfs diff=lfs merge=lfs -text
151 unmodified lines152153154155156157151 unmodified linescheckpoints/Qwopus3.5-9B-GGUF/LICENSE 11343 8d5eb5f806d01e8f5ea2c5a52f7d68ebc54b196b1cfbe1cd5dfa4b94e482a9c6 - Qwen/Qwen3.5-9B's licence text (Apache-2.0), as Jackrong/Qwopus3.5-9B-v3 carries it Apache-2.0checkpoints/Qwopus3.5-9B-GGUF/Qwopus3.5-9B-v3-AR-Q4_0.gguf 6675391200 c08446f78bc33564f3340baa2310d6a79423165f9ef365b1766373818fff038e - Jackrong/Qwopus3.5-9B-v3 (a fine-tune of Qwen/Qwen3.5-9B), quantized for Ruach Studio with AutoRound (W4A16, symmetric, group 32) and moved into GGUF bit for bit, text only: quality Q4_0 + Q8_0, compact Q4_0 + Q4_K/Q5_K/Q6_K Apache-2.0checkpoints/Qwopus3.5-9B-GGUF/Qwopus3.5-9B-v3-AR-compact.gguf 5467513568 b440b8a2162a292d225c3585863122e9eb0afffa3b9f390e66384a878b3823e7 - Jackrong/Qwopus3.5-9B-v3 (a fine-tune of Qwen/Qwen3.5-9B), quantized for Ruach Studio with AutoRound (W4A16, symmetric, group 32) and moved into GGUF bit for bit, text only: quality Q4_0 + Q8_0, compact Q4_0 + Q4_K/Q5_K/Q6_K Apache-2.0checkpoints/YuE2-Vae-legacy/LICENSE 20309 060985741d20e70613b4c189c7de106cabd3fb2109fbbfb6d705c9d619417dd0 - m-a-p/YuE2-Vae-legacy@d0585a9c CC BY-NC 4.0checkpoints/YuE2-Vae-legacy/README.md 10071 4d0c5a22994319889a55a97f9facf81c129904b4b76f4deb705a535a6968dc88 - m-a-p/YuE2-Vae-legacy@d0585a9c CC BY-NC 4.0checkpoints/YuE2-Vae-legacy/THIRD_PARTY_NOTICES.md 793 14d3fd9f6fee86b4260b69b0979735b99ffec8c6b4db254567047a4215cd9af3 - m-a-p/YuE2-Vae-legacy@d0585a9c CC BY-NC 4.0151 unmodified lines152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290151 unmodified linescheckpoints/Qwopus3.5-9B-GGUF/LICENSE 11343 8d5eb5f806d01e8f5ea2c5a52f7d68ebc54b196b1cfbe1cd5dfa4b94e482a9c6 - Qwen/Qwen3.5-9B's licence text (Apache-2.0), as Jackrong/Qwopus3.5-9B-v3 carries it Apache-2.0checkpoints/Qwopus3.5-9B-GGUF/Qwopus3.5-9B-v3-AR-Q4_0.gguf 6675391200 c08446f78bc33564f3340baa2310d6a79423165f9ef365b1766373818fff038e - Jackrong/Qwopus3.5-9B-v3 (a fine-tune of Qwen/Qwen3.5-9B), quantized for Ruach Studio with AutoRound (W4A16, symmetric, group 32) and moved into GGUF bit for bit, text only: quality Q4_0 + Q8_0, compact Q4_0 + Q4_K/Q5_K/Q6_K Apache-2.0checkpoints/Qwopus3.5-9B-GGUF/Qwopus3.5-9B-v3-AR-compact.gguf 5467513568 b440b8a2162a292d225c3585863122e9eb0afffa3b9f390e66384a878b3823e7 - Jackrong/Qwopus3.5-9B-v3 (a fine-tune of Qwen/Qwen3.5-9B), quantized for Ruach Studio with AutoRound (W4A16, symmetric, group 32) and moved into GGUF bit for bit, text only: quality Q4_0 + Q8_0, compact Q4_0 + Q4_K/Q5_K/Q6_K Apache-2.0checkpoints/SheetSage2/LICENSE 20000 73593d6cad4ca80f3ab1448a4908f92ab802dfffe029561e3b12fa7d07c8b87c - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/THIRD_PARTY_NOTICES.md 589 ab8b195c2c1475f254a04181a9841db2f2581c579b95858c78ee0040eb495a29 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/__init__.py 39 19539a965cabf22d08231688efc15547d005e6345745f48684c2f02d010f82fd - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/assets/architecture.png 310767 4ca7396e9a7055f6824607f17c644dd59f3c28097c6adf10ee30c19056f998ef - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/audio_sheetsage2.py 4289 ecce56e7bb8a08cbca9eb27a74d9aeff17f55e80efcc7c48f7436440f610ccc1 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/chordformer.md 3911 1365cce20f90d8ff7883864426442061dced12786c7484b63e2805e5bd57c609 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/chordformer_per_song.csv 403258 b82e957f766da5d6522207485b172c0f7f5f05dcb4946c13578c2078a42e579a - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/chordformer_results.json 4440 18d2acba5b9a1103a3cb47f04e41d29c9233bcf4db647a0e6d262d0df2b7118f - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/rock_corpus.md 1754 4209bf4c654a27904ca59855cb3470bb2b28dd9da30e9e27f0d398a9ada7a261 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/rock_corpus_per_song.csv 38285 4826dc875906b05a2509916e5e5092655e8ff8e31763f87a45db6ca69b3156cf - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/rock_corpus_results.json 1141 e1384d023cf8528b181f923e188dd3d7faeefd1102c8b97e3c7fe1e29614bbcb - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/benchmarks/score_chordformer.py 5277 3bf245833cebfa68db954c0e43f4ffa2fce2302b5c1b4b53d2f80b9fc7fe1d2f - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/chord_spelling_sheetsage2.py 9330 5a673e3c8caa6d0a4cda19227ce5587c611a2bf85343f6bc623e3d66d99ed8b1 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/config.json 2060 a986e63f5d831ecb823c11d19cfb371d763f25ae2e614ec9acd714c0b8bb87fd - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/configuration_mert2.py 3860 77b53ec9d7ee31a599d744fb006e812c7eeaf7390deb46e2f460cf8c17b00bd6 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/configuration_sheetsage2.py 4119 36d174331b3721d984608252830179bf3516d77b7225f413acc85bdf5efb3bec - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/durations_sheetsage2.py 296 abbc297b70b63a86f8509b1db74d0e85d7b46dcb83867cf33741c43f9d49db83 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/exports_sheetsage2.py 10405 11782cff50f96dac1bf1eedefed86b3cd60222e31b8456bee366eeb373b6a7e5 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/generation_sheetsage2.py 24722 b58dbbfaebfba2a441a79b8c36183f0e4956acdd3aaf7c655c559933b4c20afd - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/infer.py 4253 20e6b23c910bfdecf012a8ee8d45efcb31cb6cb21351da5921d95fb877e70de6 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/io_sheetsage2.py 1830 afb5b4d4a52b513b11cfdad40e7b9d2286dd4ff6585b89688dbb31b3d5376da6 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/labels_sheetsage2.py 978 4a80870695dd91da6070e7d8d0ce6b50f3bf71c3f629417a86cf12f4ef4f97e0 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/midi_sheetsage2.py 4230 32f80d13592c669e56683ebb4c415f13bf8278c8ad1fe43afa500347bed35099 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/model.safetensors 228738564 b235f68091a5f5b644000f2b5acb57d1e70432aca2b34ab1b9cf27236e1f4274 445066f8edbc52ef21254023a971eeb528d31c29190073d6ae654e1db573998d m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/modeling_mert2.py 17081 b1a3174e5649c4b26b0c90d8626f0adacfbbba111a58ed3bb72ad651945a2f5c - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/notation_sheetsage2.py 55775 f75f0e8b268cd9e9c622d791d3fd77d2e68ad355a4e67018c7e15aeb2bc05af7 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/pipeline_sheetsage2.py 15022 0ae572554ca375323e2aa4ea1fb25ba27e7f4d520c0ba5b101d74930c0a66c33 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/processor_config.json 277 1eed73513a74029fe74c71faba70f8cff002ae7be23ac1c926125846d1b29817 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render.py 1927 446b18e0ba7250c8584c14bda241f8d063083cd10b1432de82c3cf56736af9de - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/DejaVuSans.ttf 757076 7da195a74c55bef988d0d48f9508bd5d849425c1770dba5d7bfc6ce9ed848954 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/LICENSE.abcjs 1156 ab1072f859916529e284a8f43643146de9935041bb347a35559a96c87ce5566f - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/LICENSE.font 8816 7a083b136e64d064794c3419751e5c7dd10d2f64c108fe5ba161eae5e5958a93 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/abcjs-basic-min.js 504175 abdab74cf95c39fb9ff4ae0c96735b9c35222851f0844ce471ddd4354739bc75 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/manifest.json 11626 aa0b4bfb84d71169e4d0c9f6cc3ed5cf8761e49c2c178961aa100cf6d83000b3 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/renderer.js 7203 0756398dfe69fe1c54c8779252885fbf573d02eecbe3f2389a0b81e0f43fcd09 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/ATTRIBUTION.md 542 87237050093c1d4f47f5c459f1e18b57ea6710f92d1a57b4462f8f5aa31e11be - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A0.mp3 25585 5c47e8142b04505c888b8edd7246a8881b4b30c4340682f0264191599df232fc - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A1.mp3 25585 abab379d4d0557abb93856f816b7bb395872e656533c3fe7f02048fc993834b7 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A2.mp3 25585 e21d9ab9b30c73c0aea921c2cd0dd59fece4cc021619927c9ff3dee71f0a9679 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A3.mp3 25585 02dee2fa184b9b94a5f72886c2370bd076103ebb76fc179982fa503e549dcc10 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A4.mp3 25585 4f1671ac831bc41c845e67b18e6c9ea200fc9b753bdffe124703b7141aa928c3 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A5.mp3 18929 2cccfe0aa8077bfd20bcbba470012faa0328ae97d5bd2297147c01f2b255e574 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A6.mp3 15315 87dab2b5bfdd8bafa575fc24b99591e87e5a0c991a8bbdc8aeb8a1e517b576d2 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A7.mp3 14535 ace76663dac4610a93259655f069835e6eb397b76aedf85c1f48a5036cf25687 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab1.mp3 25585 a9889722caea82aa67a8b7f600f1def8e51e095f1f423949c3a8e9dbf5c14abd - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab2.mp3 25585 b45bb57e125cdbbc3bb521ae643e67a90c0ff646d37e5b5284e5c70bfeff6c75 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab3.mp3 25585 843d633061631861c943266b4836573fe8ba8b8a10df9bd94adc380376cdb8ce - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab4.mp3 25585 e8612f8602d1c146f9b7f69a441ee518876ccdfa469457366c8064c25d9d3116 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab5.mp3 20411 31c86a311eb68761b8008359b34addfeec249d1c7d6795a52f8f2e172e3e8a05 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab6.mp3 15757 7775c09d08d344af9528edbf7abb6f59ac600e4d15efd6f139845bb107a822ed - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab7.mp3 14691 66932305995ff04e9e0244c5a408ec87c9131ab3915eac15c72c7659132ab0f2 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B0.mp3 25585 4422d1d2f0498aec427165415f5d665d78699e8623475215ce9b27c18b3d331f - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B1.mp3 25585 048003df58298d2659bff084885ad69d9531fdc03837c7ee39c8bcf68334b5b9 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B2.mp3 25585 be2df872b00b68adead4ca24ef68bd4a93bf0c4864d455d742171e5df91e86b7 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B3.mp3 25585 82c0463af9c9fe51d44aa59b71d2dccefab11c1ea98e2748ee93244f8af9169e - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B4.mp3 25585 5f09187820410b0f78575f232c3509f367478b7755b6eb5aa46ce6cf4c16a0e8 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B5.mp3 19345 4e0932827d3e9390080c4a9acd420e9b83871a5f73723feaf61d2d7f6b628b01 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B6.mp3 15055 d31aa62152acd598d55fb02cc024e59e0176a7dc13d27813882f299cae7baf7a - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B7.mp3 14483 6e1aad1cc92f17ebf6fe6161766cce279250e67a30569649481c77ab80db1677 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb0.mp3 25585 e4734f8d0285f0e5a39db7f61023510b46fb1570743b20d287479dcaa5536adb - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb1.mp3 25585 6d4face1b6559a08af3f9a49fcbc472b43e974e072156b31850ab9a230713aa3 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb2.mp3 25585 78cc11431a2a2d52294f0c714c59107a886f637806ae2cba63d50ff53585b93e - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb3.mp3 25585 6ac0f67f18e15db35553d4fcd83ceec4473ebe639e31659ce93cf8466cb06644 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb4.mp3 25585 d8f729899595116cb62ca9b7b801b4dfb9322bdf50d1bbfa847010e43a39f8f5 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb5.mp3 19709 51224d4c26f1c89b08e43865ef55d3638367f7f40fbc92e4ab88610b54d4301d - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb6.mp3 15263 394488d6cbd2c58b40f202e5acc238abdb73f261bcebd7105fb81d091113c4aa - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb7.mp3 14457 fe72a195f6036722e587e1597e54d66ec70e0ce11768e74e39bb2319bf256f80 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C1.mp3 25585 eb3b985e3b692cfe0c48550a26843fc3da44c7630c0b7bcfd820e87c5122cccc - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C2.mp3 25585 e02c5a80c03871e1889a3bb371d853f92294c1e8538ac06f70df0fd045540207 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C3.mp3 25585 7d0409ea3c40af25c6d3d606f12890f88f896d93c381b6eb8c58497f308b30d3 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C4.mp3 25585 b6d32e0d9d0c2e4b88165a2ec27b8787a970f131a03d96d065f28f158640af96 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C5.mp3 25585 7a4be6dae323ac5564ad1a617b554fd595e5e0a63f19c3581e3ee94c33ae2e4b - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C6.mp3 19371 6a0030c071ccd6c9a722455851d65b18cb86cbfe515772a6ded4c747eda339a0 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C7.mp3 14977 5e4cadc06eb25e2302dcc5bf1af76fe85ed258759d02c46e9169376ade83845e - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C8.mp3 14327 4ec066cab9362f6706b90fedc3249fa3c221769ee95ff52d7e46aaaf0a01fd16 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D1.mp3 25585 2389562397c7bdf2a856965b8b371eb6311be3cad2875c71d8ff4a607a242cea - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D2.mp3 25585 6233cc6f3670a287e33c7b8ece3b03a787ee1e169c8355432ce0b5e194bee612 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D3.mp3 25585 b8a5ed9cf147e10f484f3ad39930130d487b12045a35cef73f48dab401e6583b - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D4.mp3 25585 90539782bdbbbe714de579bfbbe6f478e07e112c6f78d03e8ee82462fbf2a569 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D5.mp3 25585 b25b5e541807af700f4e2272ac4c55a2f9b5cc8f176fcd9961d4456803af2b87 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D6.mp3 17681 46317b9dca22a75986ecfeba93ef34c8f7bc6d4e2e0223dc64b13c9a1984110b - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D7.mp3 14873 d7db5e63d7caa2fc62e00f55366f9a5236b3a13f7eb0d141a9823e10c7cc4209 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db1.mp3 25585 84f2ba7505c515c39797eafe36295b15ee9da8adbafcfbfbfc7685532b4bdce4 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db2.mp3 25585 c5d76b97326a189786aba25685c8789f59d4dc41d5fbd4d6a6aa97986b2b7d1d - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db3.mp3 25585 c5bd77b92ad8411c47e509643a7d6fc9c74f3aaba2290e2f4aed6a2ba1446e88 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db4.mp3 25585 f49892c4e935296db1cb785000818e6a04bf0756c4443bffa6245144fdaf3e47 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db5.mp3 25585 924a70321fe728ff7a69c941029e060f529e6ada507f20357ee74039e270e588 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db6.mp3 17265 5e4b55cc27db80e899ea817c546f4c0cf15b43267f426f8de53baac770f90be7 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db7.mp3 15003 56c93ba30fa46db98590fd4c218fec88e87b02eaa0b177bcc0ad621fd9a506da - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db8.mp3 12065 1be0e2193b729fc32a4fbb82f9f46bb4c0b2cbb67027c0f07c8eeff6460b64cf - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E1.mp3 25585 740bf03f7ac2a9bbd41ae10f7daf876bc8bde6fe6d355f2f2781ae70d95c762a - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E2.mp3 25585 316b392d51d9c27334976511643112b088a9812a8e37e598957e8acc6725aad0 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E3.mp3 25585 5e556a4850b93b1adba6655372c9e58913169864c52a8e6f232f4b1e901ca2dc - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E4.mp3 25585 48bcecf53832988af83f74aa65efd7daa34f1e3ebf10de4679363b89d54f3852 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E5.mp3 25039 c48cee1a11528da53e1f780a1ed36558530f053b5ed8c7033709b2002b452513 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E6.mp3 17785 e4de8378854d6b39b40d4cf7b022f60bda097993b492639c8a0a005f02a010e0 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E7.mp3 14899 e757f51d2fb54dca2c0adb4ee6a2b86459a52e2f7dfa227529558a6a0f28fd07 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb1.mp3 25585 694e89cd30008f47411336ea1b76675503bbc5383c3849df676b2cf6b51eee67 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb2.mp3 25585 708ff787e5ae2bfa45fe386e5fadc90a9339817dd245ed6e6f62532e42fad8d2 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb3.mp3 25585 bec9944789ef9e7ec3dd7f9fcdf63ed1e5e82e29447c81be3578df9b1269b4b6 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb4.mp3 25585 96586e2865651cfa0469e762f3bd40821f6e45eecf4761a86a37bc59cfebfb2c - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb5.mp3 24753 aad99b852c20c2aee66143dd103513523566716cb2f4c6ef6ac478ef84f282b0 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb6.mp3 17915 c0f4c45d7930ed90edebfd93321807cdb7346e364ba1933867c4b49ba18d5368 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb7.mp3 14925 c23b9b43ca8ece152e59ef04832b2290e96db54f9539af3162df4054c23271c7 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F1.mp3 25585 6b83be26ca990ee91e4d404afd5756e5d63b7a6f9ac46da068c80b2692945dba - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F2.mp3 25585 7bb9c26ec86e1d32194ab5ced3805e1026e638a4a5481d556a7e3f2860141c46 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F3.mp3 25585 ff912c3211f80dc0c4f541ebd39c1db11f21cfda684d54999f9bce87aaf0cf20 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F4.mp3 25585 a7426425ed95ea8652a888d850c34c4b766c7c7a11c168ed6899c38a6836be0c - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F5.mp3 24623 d7f046daec924ce8607ec92360e0d0e42e29e4b3a108839179e04aba4adadc51 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F6.mp3 17187 6f7794d298d1036ebbd514ad1b3605ffbd280556925fba05e29b83052cbf3dfd - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F7.mp3 14795 f49b2b54f0b913f636b5822eae373a85dbb30ec5e9a6ebc18e498fdfe0547011 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G1.mp3 25585 d187e74ca3a23d08248ea4073abc0893a758c8b15c4b6af16c3ba1d2394830db - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G2.mp3 25585 034f90b9f81e5aca0012f1ff73d731308653578a7eb4bee30efca37af5afce77 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G3.mp3 25585 3b75e4dfd657723b3c7a30bca0409dce8013b4083d54e703c8ec513b535cee99 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G4.mp3 25585 37d21e13d5cecc8c0f1645c83bfe82f6032407a3b7de3dde14021c196526664e - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G5.mp3 19969 2eb949282bc676f3dc96bf5008459b5fff02696e63b70ff799ff08c36bb97058 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G6.mp3 15653 c24ccf8d6f0c6c9818fe244d150a42c42585629db413e6b245088fdb589e9f3d - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G7.mp3 14587 7cc4630a06cbc11438fac85c00b640cc7677be8332105204632b687d7127ebc4 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb1.mp3 25585 6ff97bc16a3020037f46ebe4196ce2602eed8af243b567768d4cb5d47a8ba0bc - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb2.mp3 25585 95ab26a90d088fdc938673005ba2b2a4b166ee188ffbad0c7f75fb746334b043 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb3.mp3 25585 91605f55bf0265c1e526b966a3901f9c2813473ac890f4b7330ee08874c5d30f - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb4.mp3 25585 f0db7ee32b9175907ca60cf53e6c7a129ea8e7c8f6562dc7ebe6e5c81dcbdf99 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb5.mp3 24493 bd1d81203f5338ab62372f88c0b4eb5b4a3133ef58518a8770f3dfdf34f74124 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb6.mp3 17239 c5f87e3bf666919bd1e230f6945ee4af752761faa54dc1814f854e8e9d8a7920 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb7.mp3 14665 8615b92d93fa16b4051bdc8800a6430642bdcff17e26d020ec5fd83bf89db759 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/rendering_sheetsage2.py 15862 ddbcaf314139d67727cb5df6840d7d60d671d5c67f6b185a26b840df1e2d9288 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/requirements-render.txt 58 17990cc03ded2e6041b1ee4afcb3c0af3577cba534a4537685776c76fe0642c1 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/requirements.txt 190 fc3172be36722d75ae679ec9ffcf100baaa3d6ce4b6fdfefa9b24608810fc6a2 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/schema_sheetsage2.py 3893 3ee069f0d4dcfb8080f730c43676318d471ab6b3cfef86c6c225aa63a9db182f - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/setup_render.py 1540 8ee1004067f8e50443005a761d86435337f6ee71eeabf447d543eb5f3ad5561d - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/tensors_sheetsage2.py 4645 51f72b51ed5a22c751d5adf915198490b1a95ec8959fcf9a38ee71b4444fc8b3 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/tests/test_spelling.py 7742 9a7888f1b29546bdb1fc8858b1409b724e29984a43f66d6710a4cd49820ee230 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/SheetSage2/tokenization_sheetsage2.py 30043 2ad9f7734e3d9f750fe575f22fd9ec03a9a4ab52497a6314e76f53ed9024fa75 - m-a-p/SheetSage2@b83c3d79 CC BY-NC 4.0checkpoints/YuE2-Vae-legacy/LICENSE 20309 060985741d20e70613b4c189c7de106cabd3fb2109fbbfb6d705c9d619417dd0 - m-a-p/YuE2-Vae-legacy@d0585a9c CC BY-NC 4.0checkpoints/YuE2-Vae-legacy/README.md 10071 4d0c5a22994319889a55a97f9facf81c129904b4b76f4deb705a535a6968dc88 - m-a-p/YuE2-Vae-legacy@d0585a9c CC BY-NC 4.0checkpoints/YuE2-Vae-legacy/THIRD_PARTY_NOTICES.md 793 14d3fd9f6fee86b4260b69b0979735b99ffec8c6b4db254567047a4215cd9af3 - m-a-p/YuE2-Vae-legacy@d0585a9c CC BY-NC 4.0
69 unmodified lines70717273747569 unmodified lines| `models/muscriptor/` | 3.57 GB | the Refiner's sound to MIDI (MuScriptor small, medium, large; f16 GGUF), its `LICENSE` and `NOTICE.md` beside it | [DamRsn/muscriptor-gguf](https://huggingface.co/DamRsn/muscriptor-gguf), of [MuScriptor](https://huggingface.co/MuScriptor) by Mirelo and Kyutai | CC BY-NC 4.0 || `checkpoints/YuE2-Vae/`, `checkpoints/YuE2-Vae-legacy/`, `checkpoints/YuE2-Vae-merge-0.666/` | 1.59 GB | the three decoders as their authors publish them (safetensors), the sources of the GGUFs in `models/`, with their cards and licences | [m-a-p/YuE2-Vae](https://huggingface.co/m-a-p/YuE2-Vae), [m-a-p/YuE2-Vae-legacy](https://huggingface.co/m-a-p/YuE2-Vae-legacy), [Mothersuperior/YuE2-Vae-merge-0.666](https://huggingface.co/Mothersuperior/YuE2-Vae-merge-0.666) | CC BY-NC 4.0 || `checkpoints/MERT-v2-30s/` | 2.53 GB | MERT-v2 for 30-second clips, the listener's ear beside MERT-v2-FullSong, its `LICENSE` and notices beside it | [m-a-p/MERT-v2-30s](https://huggingface.co/m-a-p/MERT-v2-30s) | CC BY-NC 4.0 |**The fine-tunes and the Artist's adapters are here because their authors let them be shared.** On Civitai each of these allows sharing and selling the model itself and its merges; they are credited all the same. Many others the Artist paints with allow running and renting but not sharing the file (Outpaint, Turbo 4 steps, High Resolution, More Real, Cinematic Photography, Flux Pro Style, the FinalCut fine-tune of 2.1 and more): they stay with their authors on Civitai; taken from there into `artwork/loras/` or `artwork/Qwen-Image-2.1/checkpoints/`, the Artist offers them.69 unmodified lines7071727374757669 unmodified lines| `models/muscriptor/` | 3.57 GB | the Refiner's sound to MIDI (MuScriptor small, medium, large; f16 GGUF), its `LICENSE` and `NOTICE.md` beside it | [DamRsn/muscriptor-gguf](https://huggingface.co/DamRsn/muscriptor-gguf), of [MuScriptor](https://huggingface.co/MuScriptor) by Mirelo and Kyutai | CC BY-NC 4.0 || `checkpoints/YuE2-Vae/`, `checkpoints/YuE2-Vae-legacy/`, `checkpoints/YuE2-Vae-merge-0.666/` | 1.59 GB | the three decoders as their authors publish them (safetensors), the sources of the GGUFs in `models/`, with their cards and licences | [m-a-p/YuE2-Vae](https://huggingface.co/m-a-p/YuE2-Vae), [m-a-p/YuE2-Vae-legacy](https://huggingface.co/m-a-p/YuE2-Vae-legacy), [Mothersuperior/YuE2-Vae-merge-0.666](https://huggingface.co/Mothersuperior/YuE2-Vae-merge-0.666) | CC BY-NC 4.0 || `checkpoints/MERT-v2-30s/` | 2.53 GB | MERT-v2 for 30-second clips, the listener's ear beside MERT-v2-FullSong, its `LICENSE` and notices beside it | [m-a-p/MERT-v2-30s](https://huggingface.co/m-a-p/MERT-v2-30s) | CC BY-NC 4.0 || `checkpoints/SheetSage2/` | 0.23 GB | the transcriber as m-a-p publishes it (safetensors and its code), the source of `models/SheetSage2-*.gguf` | [m-a-p/SheetSage2](https://huggingface.co/m-a-p/SheetSage2) | CC BY-NC 4.0 |**The fine-tunes and the Artist's adapters are here because their authors let them be shared.** On Civitai each of these allows sharing and selling the model itself and its merges; they are credited all the same. Many others the Artist paints with allow running and renting but not sharing the file (Outpaint, Turbo 4 steps, High Resolution, More Real, Cinematic Photography, Flux Pro Style, the FinalCut fine-tune of 2.1 and more): they stay with their authors on Civitai; taken from there into `artwork/loras/` or `artwork/Qwen-Image-2.1/checkpoints/`, the Artist offers them.
147 unmodified lines148149150151152153147 unmodified lines2b9e2b61d32385f335b6e78038a4a3a2b810c4c9b68851ed7ac4633a5a7def81 checkpoints/Qwen2.5-Omni-7B-GGUF/unsloth/Qwen2.5-Omni-7B-Q5_K_M.gguf23cc198c9f722222458c808c402cd9812086953d1d530cdbd62772be4e575a75 checkpoints/Qwen2.5-Omni-7B-GGUF/unsloth/Qwen2.5-Omni-7B-Q6_K.gguf9ef3697f85a83c278ec45f13a4604462564500992accab777d73f8aac9d411eb checkpoints/Qwen2.5-Omni-7B-GGUF/unsloth/Qwen2.5-Omni-7B-UD-Q2_K_XL.gguf060985741d20e70613b4c189c7de106cabd3fb2109fbbfb6d705c9d619417dd0 checkpoints/YuE2-Vae-legacy/LICENSE4d0c5a22994319889a55a97f9facf81c129904b4b76f4deb705a535a6968dc88 checkpoints/YuE2-Vae-legacy/README.md14d3fd9f6fee86b4260b69b0979735b99ffec8c6b4db254567047a4215cd9af3 checkpoints/YuE2-Vae-legacy/THIRD_PARTY_NOTICES.md147 unmodified lines148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286147 unmodified lines2b9e2b61d32385f335b6e78038a4a3a2b810c4c9b68851ed7ac4633a5a7def81 checkpoints/Qwen2.5-Omni-7B-GGUF/unsloth/Qwen2.5-Omni-7B-Q5_K_M.gguf23cc198c9f722222458c808c402cd9812086953d1d530cdbd62772be4e575a75 checkpoints/Qwen2.5-Omni-7B-GGUF/unsloth/Qwen2.5-Omni-7B-Q6_K.gguf9ef3697f85a83c278ec45f13a4604462564500992accab777d73f8aac9d411eb checkpoints/Qwen2.5-Omni-7B-GGUF/unsloth/Qwen2.5-Omni-7B-UD-Q2_K_XL.gguf73593d6cad4ca80f3ab1448a4908f92ab802dfffe029561e3b12fa7d07c8b87c checkpoints/SheetSage2/LICENSEab8b195c2c1475f254a04181a9841db2f2581c579b95858c78ee0040eb495a29 checkpoints/SheetSage2/THIRD_PARTY_NOTICES.md19539a965cabf22d08231688efc15547d005e6345745f48684c2f02d010f82fd checkpoints/SheetSage2/__init__.py4ca7396e9a7055f6824607f17c644dd59f3c28097c6adf10ee30c19056f998ef checkpoints/SheetSage2/assets/architecture.pngecce56e7bb8a08cbca9eb27a74d9aeff17f55e80efcc7c48f7436440f610ccc1 checkpoints/SheetSage2/audio_sheetsage2.py1365cce20f90d8ff7883864426442061dced12786c7484b63e2805e5bd57c609 checkpoints/SheetSage2/benchmarks/chordformer.mdb82e957f766da5d6522207485b172c0f7f5f05dcb4946c13578c2078a42e579a checkpoints/SheetSage2/benchmarks/chordformer_per_song.csv18d2acba5b9a1103a3cb47f04e41d29c9233bcf4db647a0e6d262d0df2b7118f checkpoints/SheetSage2/benchmarks/chordformer_results.json4209bf4c654a27904ca59855cb3470bb2b28dd9da30e9e27f0d398a9ada7a261 checkpoints/SheetSage2/benchmarks/rock_corpus.md4826dc875906b05a2509916e5e5092655e8ff8e31763f87a45db6ca69b3156cf checkpoints/SheetSage2/benchmarks/rock_corpus_per_song.csve1384d023cf8528b181f923e188dd3d7faeefd1102c8b97e3c7fe1e29614bbcb checkpoints/SheetSage2/benchmarks/rock_corpus_results.json3bf245833cebfa68db954c0e43f4ffa2fce2302b5c1b4b53d2f80b9fc7fe1d2f checkpoints/SheetSage2/benchmarks/score_chordformer.py5a673e3c8caa6d0a4cda19227ce5587c611a2bf85343f6bc623e3d66d99ed8b1 checkpoints/SheetSage2/chord_spelling_sheetsage2.pya986e63f5d831ecb823c11d19cfb371d763f25ae2e614ec9acd714c0b8bb87fd checkpoints/SheetSage2/config.json77b53ec9d7ee31a599d744fb006e812c7eeaf7390deb46e2f460cf8c17b00bd6 checkpoints/SheetSage2/configuration_mert2.py36d174331b3721d984608252830179bf3516d77b7225f413acc85bdf5efb3bec checkpoints/SheetSage2/configuration_sheetsage2.pyabbc297b70b63a86f8509b1db74d0e85d7b46dcb83867cf33741c43f9d49db83 checkpoints/SheetSage2/durations_sheetsage2.py11782cff50f96dac1bf1eedefed86b3cd60222e31b8456bee366eeb373b6a7e5 checkpoints/SheetSage2/exports_sheetsage2.pyb58dbbfaebfba2a441a79b8c36183f0e4956acdd3aaf7c655c559933b4c20afd checkpoints/SheetSage2/generation_sheetsage2.py20e6b23c910bfdecf012a8ee8d45efcb31cb6cb21351da5921d95fb877e70de6 checkpoints/SheetSage2/infer.pyafb5b4d4a52b513b11cfdad40e7b9d2286dd4ff6585b89688dbb31b3d5376da6 checkpoints/SheetSage2/io_sheetsage2.py4a80870695dd91da6070e7d8d0ce6b50f3bf71c3f629417a86cf12f4ef4f97e0 checkpoints/SheetSage2/labels_sheetsage2.py32f80d13592c669e56683ebb4c415f13bf8278c8ad1fe43afa500347bed35099 checkpoints/SheetSage2/midi_sheetsage2.pyb235f68091a5f5b644000f2b5acb57d1e70432aca2b34ab1b9cf27236e1f4274 checkpoints/SheetSage2/model.safetensorsb1a3174e5649c4b26b0c90d8626f0adacfbbba111a58ed3bb72ad651945a2f5c checkpoints/SheetSage2/modeling_mert2.pyf75f0e8b268cd9e9c622d791d3fd77d2e68ad355a4e67018c7e15aeb2bc05af7 checkpoints/SheetSage2/notation_sheetsage2.py0ae572554ca375323e2aa4ea1fb25ba27e7f4d520c0ba5b101d74930c0a66c33 checkpoints/SheetSage2/pipeline_sheetsage2.py1eed73513a74029fe74c71faba70f8cff002ae7be23ac1c926125846d1b29817 checkpoints/SheetSage2/processor_config.json446b18e0ba7250c8584c14bda241f8d063083cd10b1432de82c3cf56736af9de checkpoints/SheetSage2/render.py7da195a74c55bef988d0d48f9508bd5d849425c1770dba5d7bfc6ce9ed848954 checkpoints/SheetSage2/render_assets/DejaVuSans.ttfab1072f859916529e284a8f43643146de9935041bb347a35559a96c87ce5566f checkpoints/SheetSage2/render_assets/LICENSE.abcjs7a083b136e64d064794c3419751e5c7dd10d2f64c108fe5ba161eae5e5958a93 checkpoints/SheetSage2/render_assets/LICENSE.fontabdab74cf95c39fb9ff4ae0c96735b9c35222851f0844ce471ddd4354739bc75 checkpoints/SheetSage2/render_assets/abcjs-basic-min.jsaa0b4bfb84d71169e4d0c9f6cc3ed5cf8761e49c2c178961aa100cf6d83000b3 checkpoints/SheetSage2/render_assets/manifest.json0756398dfe69fe1c54c8779252885fbf573d02eecbe3f2389a0b81e0f43fcd09 checkpoints/SheetSage2/render_assets/renderer.js87237050093c1d4f47f5c459f1e18b57ea6710f92d1a57b4462f8f5aa31e11be checkpoints/SheetSage2/render_assets/soundfonts/ATTRIBUTION.md5c47e8142b04505c888b8edd7246a8881b4b30c4340682f0264191599df232fc checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A0.mp3abab379d4d0557abb93856f816b7bb395872e656533c3fe7f02048fc993834b7 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A1.mp3e21d9ab9b30c73c0aea921c2cd0dd59fece4cc021619927c9ff3dee71f0a9679 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A2.mp302dee2fa184b9b94a5f72886c2370bd076103ebb76fc179982fa503e549dcc10 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A3.mp34f1671ac831bc41c845e67b18e6c9ea200fc9b753bdffe124703b7141aa928c3 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A4.mp32cccfe0aa8077bfd20bcbba470012faa0328ae97d5bd2297147c01f2b255e574 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A5.mp387dab2b5bfdd8bafa575fc24b99591e87e5a0c991a8bbdc8aeb8a1e517b576d2 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A6.mp3ace76663dac4610a93259655f069835e6eb397b76aedf85c1f48a5036cf25687 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A7.mp3a9889722caea82aa67a8b7f600f1def8e51e095f1f423949c3a8e9dbf5c14abd checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab1.mp3b45bb57e125cdbbc3bb521ae643e67a90c0ff646d37e5b5284e5c70bfeff6c75 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab2.mp3843d633061631861c943266b4836573fe8ba8b8a10df9bd94adc380376cdb8ce checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab3.mp3e8612f8602d1c146f9b7f69a441ee518876ccdfa469457366c8064c25d9d3116 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab4.mp331c86a311eb68761b8008359b34addfeec249d1c7d6795a52f8f2e172e3e8a05 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab5.mp37775c09d08d344af9528edbf7abb6f59ac600e4d15efd6f139845bb107a822ed checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab6.mp366932305995ff04e9e0244c5a408ec87c9131ab3915eac15c72c7659132ab0f2 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab7.mp34422d1d2f0498aec427165415f5d665d78699e8623475215ce9b27c18b3d331f checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B0.mp3048003df58298d2659bff084885ad69d9531fdc03837c7ee39c8bcf68334b5b9 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B1.mp3be2df872b00b68adead4ca24ef68bd4a93bf0c4864d455d742171e5df91e86b7 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B2.mp382c0463af9c9fe51d44aa59b71d2dccefab11c1ea98e2748ee93244f8af9169e checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B3.mp35f09187820410b0f78575f232c3509f367478b7755b6eb5aa46ce6cf4c16a0e8 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B4.mp34e0932827d3e9390080c4a9acd420e9b83871a5f73723feaf61d2d7f6b628b01 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B5.mp3d31aa62152acd598d55fb02cc024e59e0176a7dc13d27813882f299cae7baf7a checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B6.mp36e1aad1cc92f17ebf6fe6161766cce279250e67a30569649481c77ab80db1677 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/B7.mp3e4734f8d0285f0e5a39db7f61023510b46fb1570743b20d287479dcaa5536adb checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb0.mp36d4face1b6559a08af3f9a49fcbc472b43e974e072156b31850ab9a230713aa3 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb1.mp378cc11431a2a2d52294f0c714c59107a886f637806ae2cba63d50ff53585b93e checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb2.mp36ac0f67f18e15db35553d4fcd83ceec4473ebe639e31659ce93cf8466cb06644 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb3.mp3d8f729899595116cb62ca9b7b801b4dfb9322bdf50d1bbfa847010e43a39f8f5 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb4.mp351224d4c26f1c89b08e43865ef55d3638367f7f40fbc92e4ab88610b54d4301d checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb5.mp3394488d6cbd2c58b40f202e5acc238abdb73f261bcebd7105fb81d091113c4aa checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb6.mp3fe72a195f6036722e587e1597e54d66ec70e0ce11768e74e39bb2319bf256f80 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Bb7.mp3eb3b985e3b692cfe0c48550a26843fc3da44c7630c0b7bcfd820e87c5122cccc checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C1.mp3e02c5a80c03871e1889a3bb371d853f92294c1e8538ac06f70df0fd045540207 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C2.mp37d0409ea3c40af25c6d3d606f12890f88f896d93c381b6eb8c58497f308b30d3 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C3.mp3b6d32e0d9d0c2e4b88165a2ec27b8787a970f131a03d96d065f28f158640af96 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C4.mp37a4be6dae323ac5564ad1a617b554fd595e5e0a63f19c3581e3ee94c33ae2e4b checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C5.mp36a0030c071ccd6c9a722455851d65b18cb86cbfe515772a6ded4c747eda339a0 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C6.mp35e4cadc06eb25e2302dcc5bf1af76fe85ed258759d02c46e9169376ade83845e checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C7.mp34ec066cab9362f6706b90fedc3249fa3c221769ee95ff52d7e46aaaf0a01fd16 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/C8.mp32389562397c7bdf2a856965b8b371eb6311be3cad2875c71d8ff4a607a242cea checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D1.mp36233cc6f3670a287e33c7b8ece3b03a787ee1e169c8355432ce0b5e194bee612 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D2.mp3b8a5ed9cf147e10f484f3ad39930130d487b12045a35cef73f48dab401e6583b checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D3.mp390539782bdbbbe714de579bfbbe6f478e07e112c6f78d03e8ee82462fbf2a569 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D4.mp3b25b5e541807af700f4e2272ac4c55a2f9b5cc8f176fcd9961d4456803af2b87 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D5.mp346317b9dca22a75986ecfeba93ef34c8f7bc6d4e2e0223dc64b13c9a1984110b checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D6.mp3d7db5e63d7caa2fc62e00f55366f9a5236b3a13f7eb0d141a9823e10c7cc4209 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/D7.mp384f2ba7505c515c39797eafe36295b15ee9da8adbafcfbfbfc7685532b4bdce4 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db1.mp3c5d76b97326a189786aba25685c8789f59d4dc41d5fbd4d6a6aa97986b2b7d1d checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db2.mp3c5bd77b92ad8411c47e509643a7d6fc9c74f3aaba2290e2f4aed6a2ba1446e88 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db3.mp3f49892c4e935296db1cb785000818e6a04bf0756c4443bffa6245144fdaf3e47 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db4.mp3924a70321fe728ff7a69c941029e060f529e6ada507f20357ee74039e270e588 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db5.mp35e4b55cc27db80e899ea817c546f4c0cf15b43267f426f8de53baac770f90be7 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db6.mp356c93ba30fa46db98590fd4c218fec88e87b02eaa0b177bcc0ad621fd9a506da checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db7.mp31be0e2193b729fc32a4fbb82f9f46bb4c0b2cbb67027c0f07c8eeff6460b64cf checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Db8.mp3740bf03f7ac2a9bbd41ae10f7daf876bc8bde6fe6d355f2f2781ae70d95c762a checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E1.mp3316b392d51d9c27334976511643112b088a9812a8e37e598957e8acc6725aad0 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E2.mp35e556a4850b93b1adba6655372c9e58913169864c52a8e6f232f4b1e901ca2dc checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E3.mp348bcecf53832988af83f74aa65efd7daa34f1e3ebf10de4679363b89d54f3852 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E4.mp3c48cee1a11528da53e1f780a1ed36558530f053b5ed8c7033709b2002b452513 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E5.mp3e4de8378854d6b39b40d4cf7b022f60bda097993b492639c8a0a005f02a010e0 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E6.mp3e757f51d2fb54dca2c0adb4ee6a2b86459a52e2f7dfa227529558a6a0f28fd07 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/E7.mp3694e89cd30008f47411336ea1b76675503bbc5383c3849df676b2cf6b51eee67 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb1.mp3708ff787e5ae2bfa45fe386e5fadc90a9339817dd245ed6e6f62532e42fad8d2 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb2.mp3bec9944789ef9e7ec3dd7f9fcdf63ed1e5e82e29447c81be3578df9b1269b4b6 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb3.mp396586e2865651cfa0469e762f3bd40821f6e45eecf4761a86a37bc59cfebfb2c checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb4.mp3aad99b852c20c2aee66143dd103513523566716cb2f4c6ef6ac478ef84f282b0 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb5.mp3c0f4c45d7930ed90edebfd93321807cdb7346e364ba1933867c4b49ba18d5368 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb6.mp3c23b9b43ca8ece152e59ef04832b2290e96db54f9539af3162df4054c23271c7 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Eb7.mp36b83be26ca990ee91e4d404afd5756e5d63b7a6f9ac46da068c80b2692945dba checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F1.mp37bb9c26ec86e1d32194ab5ced3805e1026e638a4a5481d556a7e3f2860141c46 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F2.mp3ff912c3211f80dc0c4f541ebd39c1db11f21cfda684d54999f9bce87aaf0cf20 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F3.mp3a7426425ed95ea8652a888d850c34c4b766c7c7a11c168ed6899c38a6836be0c checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F4.mp3d7f046daec924ce8607ec92360e0d0e42e29e4b3a108839179e04aba4adadc51 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F5.mp36f7794d298d1036ebbd514ad1b3605ffbd280556925fba05e29b83052cbf3dfd checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F6.mp3f49b2b54f0b913f636b5822eae373a85dbb30ec5e9a6ebc18e498fdfe0547011 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/F7.mp3d187e74ca3a23d08248ea4073abc0893a758c8b15c4b6af16c3ba1d2394830db checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G1.mp3034f90b9f81e5aca0012f1ff73d731308653578a7eb4bee30efca37af5afce77 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G2.mp33b75e4dfd657723b3c7a30bca0409dce8013b4083d54e703c8ec513b535cee99 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G3.mp337d21e13d5cecc8c0f1645c83bfe82f6032407a3b7de3dde14021c196526664e checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G4.mp32eb949282bc676f3dc96bf5008459b5fff02696e63b70ff799ff08c36bb97058 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G5.mp3c24ccf8d6f0c6c9818fe244d150a42c42585629db413e6b245088fdb589e9f3d checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G6.mp37cc4630a06cbc11438fac85c00b640cc7677be8332105204632b687d7127ebc4 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/G7.mp36ff97bc16a3020037f46ebe4196ce2602eed8af243b567768d4cb5d47a8ba0bc checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb1.mp395ab26a90d088fdc938673005ba2b2a4b166ee188ffbad0c7f75fb746334b043 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb2.mp391605f55bf0265c1e526b966a3901f9c2813473ac890f4b7330ee08874c5d30f checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb3.mp3f0db7ee32b9175907ca60cf53e6c7a129ea8e7c8f6562dc7ebe6e5c81dcbdf99 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb4.mp3bd1d81203f5338ab62372f88c0b4eb5b4a3133ef58518a8770f3dfdf34f74124 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb5.mp3c5f87e3bf666919bd1e230f6945ee4af752761faa54dc1814f854e8e9d8a7920 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb6.mp38615b92d93fa16b4051bdc8800a6430642bdcff17e26d020ec5fd83bf89db759 checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Gb7.mp3ddbcaf314139d67727cb5df6840d7d60d671d5c67f6b185a26b840df1e2d9288 checkpoints/SheetSage2/rendering_sheetsage2.py17990cc03ded2e6041b1ee4afcb3c0af3577cba534a4537685776c76fe0642c1 checkpoints/SheetSage2/requirements-render.txtfc3172be36722d75ae679ec9ffcf100baaa3d6ce4b6fdfefa9b24608810fc6a2 checkpoints/SheetSage2/requirements.txt3ee069f0d4dcfb8080f730c43676318d471ab6b3cfef86c6c225aa63a9db182f checkpoints/SheetSage2/schema_sheetsage2.py8ee1004067f8e50443005a761d86435337f6ee71eeabf447d543eb5f3ad5561d checkpoints/SheetSage2/setup_render.py51f72b51ed5a22c751d5adf915198490b1a95ec8959fcf9a38ee71b4444fc8b3 checkpoints/SheetSage2/tensors_sheetsage2.py9a7888f1b29546bdb1fc8858b1409b724e29984a43f66d6710a4cd49820ee230 checkpoints/SheetSage2/tests/test_spelling.py2ad9f7734e3d9f750fe575f22fd9ec03a9a4ab52497a6314e76f53ed9024fa75 checkpoints/SheetSage2/tokenization_sheetsage2.py060985741d20e70613b4c189c7de106cabd3fb2109fbbfb6d705c9d619417dd0 checkpoints/YuE2-Vae-legacy/LICENSE4d0c5a22994319889a55a97f9facf81c129904b4b76f4deb705a535a6968dc88 checkpoints/YuE2-Vae-legacy/README.md14d3fd9f6fee86b4260b69b0979735b99ffec8c6b4db254567047a4215cd9af3 checkpoints/YuE2-Vae-legacy/THIRD_PARTY_NOTICES.md
178 unmodified lines179180181182183184178 unmodified lines- `models/MERT-v2-FullSong-F32.gguf`- `models/MERT-v2-FullSong-Q8_0.gguf`## m-a-p/SheetSage2 as GGUF, its head (Serveurperso/YuE2-GGUF)Licence: CC BY-NC 4.0178 unmodified lines179180181182183184185186187188189190191192193194195196197198199200201178 unmodified lines- `models/MERT-v2-FullSong-F32.gguf`- `models/MERT-v2-FullSong-Q8_0.gguf`## m-a-p/SheetSage2 (the transcriber as m-a-p publishes it)Licence: CC BY-NC 4.0- `checkpoints/SheetSage2/LICENSE`- `checkpoints/SheetSage2/THIRD_PARTY_NOTICES.md`- `checkpoints/SheetSage2/__init__.py`- `checkpoints/SheetSage2/assets/…`- `checkpoints/SheetSage2/audio_sheetsage2.py`- `checkpoints/SheetSage2/benchmarks/…`- `checkpoints/SheetSage2/chord_spelling_sheetsage2.py`- `checkpoints/SheetSage2/config.json`- `checkpoints/SheetSage2/configuration_mert2.py`- `checkpoints/SheetSage2/configuration_sheetsage2.py`- `checkpoints/SheetSage2/durations_sheetsage2.py`- `checkpoints/SheetSage2/exports_sheetsage2.py`## m-a-p/SheetSage2 as GGUF, its head (Serveurperso/YuE2-GGUF)Licence: CC BY-NC 4.0
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424MERT2 model-weight license
The MERT2-30s and MERT2-FS checkpoint weights in model.safetensors arelicensed under Creative Commons Attribution-NonCommercial 4.0 International(CC BY-NC 4.0): https://creativecommons.org/licenses/by-nc/4.0/
For attribution, identify MERT2, the model name, and its source repository:https://huggingface.co/m-a-p/MERT-v2-30shttps://huggingface.co/m-a-p/MERT-v2-FullSong
This weight license does not replace separately applicable licenses for codeor dependencies. See THIRD_PARTY_NOTICES.md.
The official license text follows without modification.Source: https://creativecommons.org/licenses/by-nc/4.0/legalcode.txt
Attribution-NonCommercial 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm anddoes not provide legal services or legal advice. Distribution ofCreative Commons public licenses does not create a lawyer-client orother relationship. Creative Commons makes its licenses and relatedinformation available on an "as-is" basis. Creative Commons gives nowarranties regarding its licenses, any material licensed under theirterms and conditions, or any related information. Creative Commonsdisclaims all liability for damages resulting from their use to thefullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms andconditions that creators and other rights holders may use to shareoriginal works of authorship and other material subject to copyrightand certain other rights specified in the public license below. Thefollowing considerations are for informational purposes only, are notexhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC- licensed material, or material used under an exception or limitation to copyright. More considerations for licensors: wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor's permission is not necessary for any reason--for example, because of any applicable exception or limitation to copyright--then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public: wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution-NonCommercial 4.0 International PublicLicense
By exercising the Licensed Rights (defined below), You accept and agreeto be bound by the terms and conditions of this Creative CommonsAttribution-NonCommercial 4.0 International Public License ("PublicLicense"). To the extent this Public License may be interpreted as acontract, You are granted the Licensed Rights in consideration of Youracceptance of these terms and conditions, and the Licensor grants Yousuch rights in consideration of benefits the Licensor receives frommaking the Licensed Material available under these terms andconditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights. d. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
g. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
i. NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
j. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
k. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
l. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
b. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a) (4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
b. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to thefollowing conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
a. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
b. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights thatapply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does notreplace Your obligations under this Public License where the LicensedRights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its publiclicenses. Notwithstanding, Creative Commons may elect to apply one ofits public licenses to material it publishes and in those instanceswill be considered the “Licensor.” The text of the Creative Commonspublic licenses is dedicated to the public domain under the CC0 PublicDomain Dedication. Except for the limited purpose of indicating thatmaterial is shared under a Creative Commons public license or asotherwise permitted by the Creative Commons policies published atcreativecommons.org/policies, Creative Commons does not authorize theuse of the trademark "Creative Commons" or any other trademark or logoof Creative Commons without its prior written consent including,without limitation, in connection with any unauthorized modificationsto any of its public licenses or any other arrangements,understandings, or agreements concerning use of licensed material. Forthe avoidance of doubt, this paragraph does not form part of thepublic licenses.
Creative Commons may be contacted at creativecommons.org.
12345678# Third-party notices
- MERT-v2-FullSong provides the public music encoder. Its weight terms remain CC BY-NC 4.0.- The BART decoder uses Hugging Face Transformers (Apache 2.0); PyTorch uses its BSD-style license.- abcjs 6.6.3 is distributed under MIT; its license accompanies the rendering assets.- Playwright is distributed under Apache 2.0. Chromium is installed separately with its accompanying notices.- FluidR3 piano samples by Frank Wen use CC BY 3.0 US. Attribution and source information accompany the samples.- Other installed dependencies retain their respective licenses.1"""SheetSage2 standalone inference."""1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192"""File decoding and waveform preparation for music transcription."""from pathlib import Pathimport ioimport mathimport numbersimport shutilimport subprocess
import numpy as npimport torch
SAMPLE_RATE = 24000
def _encoded_bytes(audio): if isinstance(audio, (bytes, bytearray, memoryview)): return bytes(audio) if callable(getattr(audio, "read", None)): position = None try: position = audio.tell() audio.seek(0) except (AttributeError, OSError, ValueError, io.UnsupportedOperation): position = None try: value = audio.read() finally: if position is not None: audio.seek(position) if not isinstance(value, (bytes, bytearray)): raise ValueError("Audio streams must return encoded audio bytes") return bytes(value) return None
def load_audio(audio, *, sampling_rate=None, max_seconds=None, preset="default"): if max_seconds is not None and (not math.isfinite(max_seconds) or max_seconds <= 0): raise ValueError("max_seconds must be finite and positive") encoded = _encoded_bytes(audio) if encoded is not None and not encoded: raise ValueError("Encoded audio must not be empty") if isinstance(audio, (str, Path)) or encoded is not None: if preset == "paper": import torchaudio source = io.BytesIO(encoded) if encoded is not None else str(audio) info = torchaudio.info(source, backend="ffmpeg") if info.num_frames <= 0: raise ValueError("Cannot determine source audio length") if encoded is not None: source.seek(0) waveform, rate = torchaudio.load(source, frame_offset=0, num_frames=int(info.num_frames), backend="ffmpeg", channels_first=True) waveform = waveform.mean(dim=0) if rate != SAMPLE_RATE: waveform = torchaudio.functional.resample(waveform, rate, SAMPLE_RATE) else: if not shutil.which("ffmpeg"): raise RuntimeError("FFmpeg is required to read audio files; install it and add it to PATH") source = "pipe:0" if encoded is not None else str(Path(audio).resolve()) command = ["ffmpeg", "-v", "error", "-nostdin", "-i", source, "-vn"] if max_seconds is not None: command += ["-t", str(float(max_seconds))] command += ["-ac", "1", "-ar", str(SAMPLE_RATE), "-f", "f32le", "pipe:1"] result = subprocess.run(command, input=encoded, capture_output=True, timeout=600, check=False) if result.returncode: raise ValueError("Cannot decode audio: " + result.stderr.decode(errors="replace")[-1200:]) waveform = torch.from_numpy(np.frombuffer(result.stdout, dtype="<f4").copy()) else: if not isinstance(sampling_rate, numbers.Real) or not math.isfinite(sampling_rate) or sampling_rate <= 0 or sampling_rate != int(sampling_rate): raise ValueError("Provide sampling_rate for an array or tensor waveform") waveform = torch.as_tensor(audio, dtype=torch.float32, device="cpu") if waveform.ndim == 2: if waveform.shape[0] > 32: raise ValueError("Multichannel audio must have shape [channels, samples]") waveform = waveform.mean(dim=0) if waveform.ndim != 1: raise ValueError("Audio must have shape [samples] or [channels, samples]") if sampling_rate != SAMPLE_RATE: import torchaudio waveform = torchaudio.functional.resample(waveform, int(sampling_rate), SAMPLE_RATE) waveform = waveform.float().contiguous() if max_seconds is not None: waveform = waveform[:round(max_seconds * SAMPLE_RATE)] if waveform.numel() < 1025 or not torch.isfinite(waveform).all(): raise ValueError("Audio must contain at least 1025 finite samples at 24 kHz") return waveform
def slice_audio(audio, start, seconds): offset, count = round(start * SAMPLE_RATE), round(seconds * SAMPLE_RATE) result = audio[offset:offset + count] return torch.nn.functional.pad(result, (0, count - len(result)))1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162# ChordFormer baseline for SheetSage2
Updated 2026-09-15. ChordFormer replaces Jiang et al. (2019) as the chordspecialist in the current comparison. SheetSage2 predictions and scores are unchanged.
| Dataset | Tracks | ChordFormer maj/min (%) | Released-checkpoint inference || --- | ---: | ---: | --- || osu2017 | 142 | 86.54974535 | Average five models' component probabilities, then HMM || Chords1217 | 1,217 | 83.94339229 | One held-out fold model per track, then HMM |
Both use the official default `submission` chord vocabulary, whole-song CQT,and the upstream HMM. The setting was not selected by testing alternativevocabularies on osu2017. No models were trained or tuned on osu2017.
## Scoring protocol
We use the same frozen references and scorer as the SheetSage2 comparison:sanitize intervals, crop predictions to each reference's earliest/latest time,compute per-track `mir_eval.chord.evaluate` maj/min recall, and average thosescores weighted by each reference annotation span. All 1,359 reference-fileSHA-256 values match the archived cohorts. Scores are percentages.
The official ChordFormer corpus scorer instead pools correct and eligiblereference durations for each metric. Our separate Chords1217 reproduction withthat scorer gives **84.350128%** using `full`, matching the accepted paper's84.35%, and **84.428217%** using `submission`. The table above uses `submission`with the SheetSage2 scorer, giving **83.943392%**. These configurations andaggregation rules must not be mixed. The old 84.09% literature entry is retired.
The held-out Chords1217 evaluation uses a different model per fold. SheetSage2uses one fixed checkpoint for the collection; aligned scoring does not implyidentical training data. No audio-fingerprint-based training-overlap exclusionis claimed here.
## Reproduction
- [Official code](https://github.com/mwaseemrandhawa/ChordFormer/tree/3da11c078c802b3f5a2ff0f6f8ec184a41537844), pinned to `3da11c078c802b3f5a2ff0f6f8ec184a41537844`.- Five released `chordformer_head16(1.0,1.0)_s0.best.sdict` through `s4.best.sdict` checkpoints.- On osu2017, the official `chord_recognition.py audio.mp3 output.lab` entry uses the five-model ensemble and default vocabulary.- For Chords1217, use the fold in [the per-track record](chordformer_per_song.csv); averaging all five models would include models trained on that track and is invalid for this evaluation.- Inference used dgx-071 GPU 7 (NVIDIA H800). Compatibility changes selected logical GPU 0 after external device masking and explicitly loaded trusted upstream checkpoints with `weights_only=False`.- Two osu2017 songs, including the longest, were checked against the official entry point: identical chord labels and segment counts, with boundary differences below 5.1e-10 seconds from decimal serialization.
With one `<sample_id>.lab` per track in the reference and prediction directories:
```bashpython -m pip install numpy==1.26.4 scipy==1.13.1 mir_eval==0.7python score_chordformer.py --dataset osu2017 --reference /path/to/reference --predictions /path/to/predictionspython score_chordformer.py --dataset Chords1217 --reference /path/to/chordlab --predictions /path/to/held_out_predictions```
The scorer verifies the frozen reference hashes and complete cohort. Add`--verify-archived-predictions` when using the archived LAB predictions to verifytheir hashes too. [Machine-readable results](chordformer_results.json) and[per-track scores, folds, and hashes](chordformer_per_song.csv) support independent checks.
## Attribution
Please cite [ChordFormer](https://arxiv.org/abs/2502.11840) and its upstream[Large-Vocabulary Chord Transcription via Chord Structure Decomposition](https://archives.ismir.net/ismir2019/paper/000078.pdf),as requested by the ChordFormer repository. Keeping this upstream attributiondoes not retain the Jiang model as a current benchmark entry.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101{
"scorer_sha256": "5a74e06b566c5a39fa2c63e2bf3ee6685977d469b813e554c51397ae4b02ecb5",
"mir_eval_version": "0.7",
"code_commit": "3da11c078c802b3f5a2ff0f6f8ec184a41537844",
"results": {
"osu2017": {
"n": 142,
"majmin_percent": 86.5497453460808,
"reference_span_seconds": 19863.4298603,
"aggregation": "reference_span_weighted_mean_per_track_mir_eval_majmin",
"inference_protocol": "five_released_models_probability_ensemble",
"vocabulary": "submission",
"summary": {
"n": 142,
"total_duration": 19863.4298603,
"root_macro": 0.8613883242032796,
"root": 0.8699982308099738,
"majmin_macro": 0.859554594012657,
"majmin": 0.865497453460808,
"majmin7_macro": 0.7583045094212189,
"majmin7": 0.7619092963986849,
"tetrads_macro": 0.721755905794101,
"tetrads": 0.7261244587795053,
"sevenths_macro": 0.7583045094212189,
"sevenths": 0.7619092963986849
}
},
"Chords1217": {
"n": 1217,
"majmin_percent": 83.94339228883841,
"reference_span_seconds": 265407.54518096906,
"aggregation": "reference_span_weighted_mean_per_track_mir_eval_majmin",
"inference_protocol": "one_released_held_out_fold_model_per_track",
"vocabulary": "submission",
"summary": {
"n": 1217,
"total_duration": 265407.54518096906,
"root_macro": 0.8520906515499722,
"root": 0.8464978962575566,
"majmin_macro": 0.8458192895741599,
"majmin": 0.8394339228883841,
"majmin7_macro": 0.732118368140965,
"majmin7": 0.7239327355873252,
"tetrads_macro": 0.6712585918346368,
"tetrads": 0.6582119637377585,
"sevenths_macro": 0.732118368140965,
"sevenths": 0.7239327355873252
}
}
},
"all_reference_hashes_match": true,
"osu2017_matches_previous_audit": true,
"paper_protocol_reproduction": {
"full": 84.35012812303995,
"submission": 84.42821685658271
},
"paper_protocol_aggregation": "sum_correct_in_gamut_duration_over_sum_in_gamut_duration",
"paper_protocol_note": "These are a separate reproduction using the upstream corpus aggregation; they are not the SheetSage2 table scores.",
"checkpoint_provenance": {
"osu2017": {
"commit": "3da11c078c802b3f5a2ff0f6f8ec184a41537844",
"checkpoints": {
"cache_data/chordformer_head16(1.0,1.0)_s0.best.sdict": "2c496ad69036bd58e59a78ec1f42f60c23840c20553f08c8dd8f93b0711f5c57",
"cache_data/chordformer_head16(1.0,1.0)_s1.best.sdict": "c6072f4237bc64472bb0efc5e6ced5a8e76b15fd5a171d6b250fe88029d6647d",
"cache_data/chordformer_head16(1.0,1.0)_s2.best.sdict": "239a96e76da24c0d654739d2657e1f8341dd649cb052ce90437b4b22a8ff6e51",
"cache_data/chordformer_head16(1.0,1.0)_s3.best.sdict": "0e04b933293ad7cb6895c91a63aa6940832adb46a1b895e77afd3d837a24af1b",
"cache_data/chordformer_head16(1.0,1.0)_s4.best.sdict": "e46e18ff3f2b3f8bef8446b744f4b544d4e6d98cf937ae2b98d42bb22b3da906"
},
"packages": {
"torch": "2.2.2",
"numpy": "1.24.3",
"scipy": "1.13.1",
"librosa": "0.9.2",
"mir_eval": "0.7",
"numba": "0.60.0",
"h5py": "3.11.0",
"resampy": "0.4.3"
}
},
"Chords1217": {
"commit": "3da11c078c802b3f5a2ff0f6f8ec184a41537844",
"checkpoints": {
"cache_data/chordformer_head16(1.0,1.0)_s0.best.sdict": "2c496ad69036bd58e59a78ec1f42f60c23840c20553f08c8dd8f93b0711f5c57",
"cache_data/chordformer_head16(1.0,1.0)_s1.best.sdict": "c6072f4237bc64472bb0efc5e6ced5a8e76b15fd5a171d6b250fe88029d6647d",
"cache_data/chordformer_head16(1.0,1.0)_s2.best.sdict": "239a96e76da24c0d654739d2657e1f8341dd649cb052ce90437b4b22a8ff6e51",
"cache_data/chordformer_head16(1.0,1.0)_s3.best.sdict": "0e04b933293ad7cb6895c91a63aa6940832adb46a1b895e77afd3d837a24af1b",
"cache_data/chordformer_head16(1.0,1.0)_s4.best.sdict": "e46e18ff3f2b3f8bef8446b744f4b544d4e6d98cf937ae2b98d42bb22b3da906"
},
"packages": {
"torch": "2.8.0+cu126",
"numpy": "1.24.3",
"librosa": "0.9.2",
"mir_eval": "0.7",
"scipy": "1.13.1",
"h5py": "3.11.0",
"numba": "0.60.0",
"resampy": "0.4.3"
}
}
}
}123456789101112131415161718192021222324252627282930313233# Rock Corpus vocal melody benchmark
Vocal melody transcription on all 200 recordings in Rock Corpus (RS 200).The [official timed vocal-note lists](https://rockcorpus.midside.com/melodic_transcriptions.html)provide note onsets and pitches; note offsets are not evaluated.
| Model | Vocal pitch-class note F1 (%) ||---|---:|| SheetSage1 | 49.19 || SheetSage2-AR | **67.08** |
Scores are the mean of per-recording F1 over all 200 recordings. The sixrecordings whose references contain no pitched notes receive zero F1 andremain in the mean. Matching uses a 50-ms onset tolerance and a 50-cent pitchtolerance after folding MIDI pitches modulo 12, without offset matching.All models use the same references and recordings. These are point estimates.
SheetSage1 uses its released Jukebox-based model and automatic beats, withsix-measure chunks and the existing four-/two-measure fallback. Its singlemelody output is compared with the vocal reference. SheetSage2-AR uses thefixed validation-selected paper model, 300-second windows with 100-secondoverlap, predicted-prefix carry, and the `timestamp`, `downbeat_meter`,`melody_vocal` prompts. No checkpoints or inference settings are tuned onthese annotations. No output time alignment, octave correction, or annotationcorrection is applied.
Reference onsets within each measure derive from metrical positions and bartimestamps. Fine timing inaccuracies can therefore affect the 50-ms F1.Reference note-end estimates do not enter the metric.
- [Full-precision scores and scoring protocol](rock_corpus_results.json)- [Per-recording scores](rock_corpus_per_song.csv): 400 rows, two models × 200 recordings; F1 is on a 0–1 scale.- [Paper inference settings](../benchmark_results.json)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401model,track,precision,recall,f1,matched_notes,reference_notes,estimated_notesSheetSage1,1999,0.5740365111561866,0.48211243611584326,0.5240740740740741,283,587,493SheetSage1,a_change_is_gonna_come,0.6103896103896104,0.17407407407407408,0.2708933717579251,47,270,77SheetSage1,a_day_in_the_life,0.6170886075949367,0.6112852664576802,0.6141732283464567,195,319,316SheetSage1,a_hard_days_night,0.7164634146341463,0.7679738562091504,0.7413249211356467,235,306,328SheetSage1,a_whiter_shade_of_pale,0.4028268551236749,0.49137931034482757,0.44271844660194165,114,232,283SheetSage1,all_along_the_watchtower,0.3075,0.6910112359550562,0.42560553633217996,123,178,400SheetSage1,all_apologies,0.6151202749140894,0.6302816901408451,0.622608695652174,179,284,291SheetSage1,all_i_have_to_do_is_dream,0.8577405857740585,0.82,0.838445807770961,205,250,239SheetSage1,anarchy_in_the_uk,0.611764705882353,0.6446280991735537,0.6277665995975854,156,242,255SheetSage1,back_in_black,0.2376599634369287,0.436241610738255,0.3076923076923077,130,298,547SheetSage1,be-bop-a-lula,0.42857142857142855,0.610909090909091,0.5037481259370316,168,275,392SheetSage1,be_my_baby,0.576036866359447,0.5656108597285068,0.5707762557077626,125,221,217SheetSage1,billie_jean,0.01430615164520744,0.019646365422396856,0.016556291390728475,10,509,699SheetSage1,bitter_sweet_symphony,0.6035502958579881,0.6784922394678492,0.6388308977035491,306,451,507SheetSage1,bizarre_love_triangle,0.16947648624667258,0.7234848484848485,0.27462257368799425,191,264,1127SheetSage1,blitzkrieg_bop,0.7757009345794392,0.7477477477477478,0.7614678899082569,166,222,214SheetSage1,blowin_in_the_wind,0.573170731707317,0.4034334763948498,0.473551637279597,94,233,164SheetSage1,blue_suede_shoes,0.38285714285714284,0.5134099616858238,0.43862520458265136,134,261,350SheetSage1,blueberry_hill,0.6099290780141844,0.6013986013986014,0.6056338028169014,86,143,141SheetSage1,bo_diddley,0.5714285714285714,0.4864864864864865,0.5255474452554744,72,148,126SheetSage1,bohemian_rhapsody,0.4247787610619469,0.4452690166975881,0.43478260869565216,240,539,565SheetSage1,born_to_be_wild,0.6212624584717608,0.7083333333333334,0.6619469026548671,187,264,301SheetSage1,born_to_run,0.5604770017035775,0.7075268817204301,0.6254752851711027,329,465,587SheetSage1,both_sides_now,0.7408536585365854,0.7189349112426036,0.7297297297297297,243,338,328SheetSage1,bridge_over_troubled_water,0.4962686567164179,0.5911111111111111,0.539553752535497,133,225,268SheetSage1,brown_eyed_girl,0.5231316725978647,0.49830508474576274,0.5104166666666667,147,295,281SheetSage1,california_dreamin,0.3180428134556575,0.6582278481012658,0.42886597938144333,104,158,327SheetSage1,california_girls,0.27491408934707906,0.35555555555555557,0.310077519379845,80,225,291SheetSage1,california_love,0.4788732394366197,0.4322033898305085,0.4543429844097996,102,236,213SheetSage1,cathys_clown,0.8086124401913876,0.7511111111111111,0.7788018433179723,169,225,209SheetSage1,changes,0.584717607973422,0.4808743169398907,0.527736131934033,176,366,301SheetSage1,come_as_you_are,0.44274809160305345,0.75,0.5568,174,232,393SheetSage1,crazy,0.37815126050420167,0.26011560693641617,0.3082191780821918,45,173,119SheetSage1,crying,0.6919191919191919,0.6715686274509803,0.681592039800995,137,204,198SheetSage1,da_doo_ron_ron,0.23106060606060605,0.21554770318021202,0.22303473491773307,61,283,264SheetSage1,dancing_in_the_street,0.6583850931677019,0.6180758017492711,0.6375939849624059,212,343,322SheetSage1,dancing_queen,0.7444794952681388,0.7840531561461794,0.7637540453074434,236,301,317SheetSage1,dont_worry_baby,0.6940298507462687,0.8017241379310345,0.7439999999999999,186,232,268SheetSage1,dream_on,0.5208333333333334,0.5528255528255528,0.5363528009535161,225,407,432SheetSage1,earth_angel,0.3787878787878788,0.1976284584980237,0.25974025974025977,50,253,132SheetSage1,eight_miles_high,0.09643605870020965,0.4339622641509434,0.15780445969125212,46,106,477SheetSage1,eleanor_rigby,0.8324324324324325,0.616,0.7080459770114942,154,250,185SheetSage1,enter_sandman,0.2107843137254902,0.7350427350427351,0.32761904761904764,172,234,816SheetSage1,every_breath_you_take,0.023148148148148147,0.035842293906810034,0.02812939521800281,10,279,432SheetSage1,everyday_people,0.8137651821862348,0.7077464788732394,0.7570621468926554,201,284,247SheetSage1,fake_plastic_trees,0.8115183246073299,0.7142857142857143,0.7598039215686274,155,217,191SheetSage1,family_affair,0.5164319248826291,0.3971119133574007,0.4489795918367347,110,277,213SheetSage1,fast_car,0.632051282051282,0.7481031866464339,0.6851980542043086,493,659,780SheetSage1,folsom_prison_blues,0.19148936170212766,0.19148936170212766,0.19148936170212763,45,235,235SheetSage1,for_what_its_worth,0.6027397260273972,0.6616541353383458,0.6308243727598566,176,266,292SheetSage1,fortunate_son,0.5769230769230769,0.4669260700389105,0.5161290322580646,120,257,208SheetSage1,foxey_lady,0.0,0.0,0.0,0,0,205SheetSage1,free_fallin,0.7558139534883721,0.78,0.7677165354330708,195,250,258SheetSage1,georgia_on_my_mind,0.24427480916030533,0.15841584158415842,0.1921921921921922,32,202,131SheetSage1,gimme_shelter,0.24345146379044685,0.5563380281690141,0.33869239013933544,158,284,649SheetSage1,go_your_own_way,0.5284552845528455,0.49429657794676807,0.5108055009823183,130,263,246SheetSage1,god_only_knows,0.23655913978494625,0.3384615384615385,0.27848101265822783,66,195,279SheetSage1,god_save_the_queen,0.0,0.0,0.0,0,0,334SheetSage1,good_golly_miss_molly,0.4577259475218659,0.6541666666666667,0.5385934819897085,157,240,343SheetSage1,good_vibrations,0.453125,0.4517133956386293,0.452418096723869,145,321,320SheetSage1,great_balls_of_fire,0.3781818181818182,0.4094488188976378,0.39319470699432896,104,254,275SheetSage1,hallelujah,0.34959349593495936,0.2938496583143508,0.3193069306930693,129,439,369SheetSage1,heartbreak_hotel,0.3054187192118227,0.21754385964912282,0.2540983606557377,62,285,203SheetSage1,help,0.7204610951008645,0.7552870090634441,0.7374631268436579,250,331,347SheetSage1,heroes,0.5017543859649123,0.4612903225806452,0.48067226890756304,143,310,285SheetSage1,hey_jude,0.734,0.6911487758945386,0.711930164888458,367,531,500SheetSage1,honky_tonk_women,0.35233160621761656,0.3675675675675676,0.3597883597883598,68,185,193SheetSage1,hot_stuff,0.47412587412587415,0.7121848739495799,0.5692695214105794,339,476,715SheetSage1,hotel_california,0.35427394438722964,0.7765237020316027,0.48656294200848654,344,443,971SheetSage1,hound_dog,0.32567049808429116,0.3244274809160305,0.32504780114722753,85,262,261SheetSage1,house_of_the_rising_sun,0.27,0.42408376963350786,0.32993890020366606,81,191,300SheetSage1,i_believe_i_can_fly,0.6872852233676976,0.3875968992248062,0.4956629491945478,200,516,291SheetSage1,i_cant_make_you_love_me,0.6177606177606177,0.6015037593984962,0.6095238095238095,160,266,259SheetSage1,i_cant_stop_loving_you,0.41545893719806765,0.26380368098159507,0.3227016885553471,86,326,207SheetSage1,i_fought_the_law,0.70042194092827,0.8058252427184466,0.7494356659142212,166,206,237SheetSage1,i_got_you,0.3067226890756303,0.26838235294117646,0.2862745098039216,73,272,238SheetSage1,i_heard_it_through_the_grapevine,0.654228855721393,0.7897897897897898,0.7156462585034012,263,333,402SheetSage1,i_only_have_eyes_for_you,0.43333333333333335,0.20155038759689922,0.2751322751322751,26,129,60SheetSage1,i_saw_her_standing_there,0.575187969924812,0.6566523605150214,0.6132264529058116,153,233,266SheetSage1,i_still_havent_found_what_im_looking_for,0.595166163141994,0.718978102189781,0.6512396694214876,197,274,331SheetSage1,i_walk_the_line,0.5708333333333333,0.6715686274509803,0.6171171171171171,137,204,240SheetSage1,i_wanna_be_sedated,0.752913752913753,0.8239795918367347,0.7868453105968332,323,392,429SheetSage1,i_want_to_hold_your_hand,0.8097345132743363,0.7065637065637066,0.7546391752577319,183,259,226SheetSage1,i_want_you_back,0.5736196319018405,0.5598802395209581,0.5666666666666668,187,334,326SheetSage1,im_so_lonesome_i_could_cry,0.29207920792079206,0.3597560975609756,0.3224043715846995,59,164,202SheetSage1,im_waiting_for_the_man,0.2552083333333333,0.4066390041493776,0.31359999999999993,98,241,384SheetSage1,imagine,0.6933962264150944,0.6681818181818182,0.6805555555555556,147,220,212SheetSage1,in_bloom,0.7287066246056783,0.8048780487804879,0.7649006622516556,231,287,317SheetSage1,in_my_life,0.5015673981191222,0.7619047619047619,0.604914933837429,160,210,319SheetSage1,in_the_midnight_hour,0.49572649572649574,0.48535564853556484,0.4904862579281184,116,239,234SheetSage1,in_the_still_of_the_night,0.2968036529680365,0.32019704433497537,0.30805687203791465,65,203,219SheetSage1,its_a_mans_mans_mans_world,0.46153846153846156,0.20512820512820512,0.2840236686390532,48,234,104SheetSage1,ive_been_loving_you_too_long,0.4318181818181818,0.14671814671814673,0.21902017291066284,38,259,88SheetSage1,jailhouse_rock,0.6142433234421365,0.5214105793450882,0.564032697547684,207,397,337SheetSage1,johnny_b_goode,0.4295652173913043,0.8430034129692833,0.5691244239631336,247,293,575SheetSage1,jumpin_jack_flash,0.38197424892703863,0.42788461538461536,0.4036281179138322,89,208,233SheetSage1,kashmir,0.17101449275362318,0.1372093023255814,0.15225806451612903,59,430,345SheetSage1,layla,0.07288135593220339,0.17131474103585656,0.10225921521997623,43,251,590SheetSage1,let_it_be,0.5842696629213483,0.6099706744868035,0.5968436154949786,208,341,356SheetSage1,lets_get_it_on,0.6619385342789598,0.5656565656565656,0.6100217864923747,280,495,423SheetSage1,lets_stay_together,0.7478991596638656,0.5741935483870968,0.6496350364963503,178,310,238SheetSage1,light_my_fire,0.18091451292246521,0.7109375,0.2884310618066561,182,256,1006SheetSage1,like_a_rolling_stone,0.6601671309192201,0.4778225806451613,0.5543859649122808,237,496,359SheetSage1,little_red_corvette,0.5687103594080338,0.4686411149825784,0.5138490926456541,269,574,473SheetSage1,living_for_the_city,0.39892665474060823,0.4207547169811321,0.4095500459136822,223,530,559SheetSage1,london_calling,0.4086687306501548,0.37606837606837606,0.3916913946587537,132,351,323SheetSage1,long_tall_sally,0.5656836461126006,0.65527950310559,0.6071942446043166,211,322,373SheetSage1,lose_yourself,0.4666666666666667,0.5313531353135313,0.4969135802469136,161,303,345SheetSage1,loser,0.21779141104294478,0.4930555555555556,0.3021276595744681,71,144,326SheetSage1,losing_my_religion,0.6751412429378532,0.746875,0.7091988130563799,239,320,354SheetSage1,louie_louie,0.4424778761061947,0.5263157894736842,0.4807692307692308,150,285,339SheetSage1,love_and_happiness,0.44368600682593856,0.3002309468822171,0.35812672176308546,130,433,293SheetSage1,love_will_tear_us_apart,0.5656565656565656,0.6120218579234973,0.5879265091863517,112,183,198SheetSage1,lust_for_life,0.4351464435146444,0.5226130653266332,0.4748858447488585,208,398,478SheetSage1,maggie_may,0.3994082840236686,0.6818181818181818,0.503731343283582,270,396,676SheetSage1,maybellene,0.48427672955974843,0.40848806366047746,0.4431654676258993,154,377,318SheetSage1,me_and_bobby_mcgee,0.5352112676056338,0.5428571428571428,0.5390070921985815,304,560,568SheetSage1,mr_tambourine_man_byrds,0.34121621621621623,0.48095238095238096,0.39920948616600793,101,210,296SheetSage1,mr_tambourine_man_dylan,0.6208112874779541,0.565008025682183,0.5915966386554622,352,623,567SheetSage1,my_generation,0.3333333333333333,0.24380165289256198,0.2816229116945107,59,242,177SheetSage1,my_girl,0.6451612903225806,0.449438202247191,0.5298013245033112,120,267,186SheetSage1,mystery_train,0.46464646464646464,0.26436781609195403,0.336996336996337,46,174,99SheetSage1,no_woman_no_cry,0.5934065934065934,0.7714285714285715,0.6708074534161491,270,350,455SheetSage1,norwegian_wood,0.56875,0.6791044776119403,0.619047619047619,91,134,160SheetSage1,not_fade_away,0.2733812949640288,0.22485207100591717,0.24675324675324678,38,169,139SheetSage1,nothing_compares_2_u,0.631578947368421,0.5075528700906344,0.5628140703517587,168,331,266SheetSage1,nuthin_but_a_g_thang,0.0,0.0,0.0,0,0,11SheetSage1,one,0.5601503759398496,0.46855345911949686,0.5102739726027397,149,318,266SheetSage1,paint_it_black,0.47554347826086957,0.38802660753880264,0.42735042735042733,175,451,368SheetSage1,papa_was_a_rollin_stone,0.4388059701492537,0.5568181818181818,0.49081803005008345,294,528,670SheetSage1,papas_got_a_brand_new_bag,0.5147058823529411,0.4525862068965517,0.48165137614678893,105,232,204SheetSage1,paranoid_android,0.36312849162011174,0.5579399141630901,0.4399323181049069,130,233,358SheetSage1,people_get_ready,0.5816326530612245,0.5876288659793815,0.5846153846153846,114,194,196SheetSage1,please_please_please,0.6565656565656566,0.23214285714285715,0.34300791556728233,65,280,99SheetSage1,proud_mary,0.5449275362318841,0.8209606986899564,0.6550522648083623,188,229,345SheetSage1,purple_haze,0.2103448275862069,0.6039603960396039,0.31202046035805625,61,101,290SheetSage1,purple_rain,0.29280397022332505,0.33053221288515405,0.31052631578947365,118,357,403SheetSage1,rave_on,0.6588235294117647,0.7533632286995515,0.7029288702928871,168,223,255SheetSage1,redemption_song,0.7647058823529411,0.7673611111111112,0.7660311958405547,221,288,289SheetSage1,respect,0.43508771929824563,0.5040650406504065,0.4670433145009416,124,246,285SheetSage1,ring_of_fire,0.5920398009950248,0.5336322869955157,0.5613207547169812,119,223,201SheetSage1,river_deep_mountain_high,0.4555160142348754,0.35555555555555557,0.3993759750390016,128,360,281SheetSage1,rock_and_roll_music,0.8134715025906736,0.7040358744394619,0.7548076923076923,314,446,386SheetSage1,rock_around_the_clock,0.3671399594320487,0.6053511705685619,0.45707070707070707,181,299,493SheetSage1,rock_lobster,0.0,0.0,0.0,0,0,659SheetSage1,rockin_in_the_free_world,0.5546558704453441,0.8726114649681529,0.6782178217821783,274,314,494SheetSage1,roll_over_beethoven,0.49448123620309054,0.6746987951807228,0.5707006369426751,224,332,453SheetSage1,sabotage,0.0,0.0,0.0,0,0,344SheetSage1,satisfaction,0.6346666666666667,0.6704225352112676,0.6520547945205479,238,355,375SheetSage1,september_gurls,0.5836734693877551,0.7185929648241206,0.6441441441441441,143,199,245SheetSage1,shake_rattle_and_roll,0.4813664596273292,0.49363057324840764,0.4874213836477987,155,314,322SheetSage1,she_loves_you,0.7522123893805309,0.6513409961685823,0.6981519507186859,170,261,226SheetSage1,should_i_stay_or_should_i_go,0.540625,0.6156583629893239,0.5757071547420965,173,281,320SheetSage1,shout,0.5423728813559322,0.48792884371029227,0.5137123745819397,384,787,708SheetSage1,smells_like_teen_spirit,0.5904761904761905,0.7828282828282829,0.6731813246471227,310,396,525SheetSage1,stairway_to_heaven,0.4304857621440536,0.5376569037656904,0.4781395348837209,257,478,597SheetSage1,stand_by_me,0.5276752767527675,0.6217391304347826,0.5708582834331337,143,230,271SheetSage1,strawberry_fields_forever,0.522633744855967,0.4601449275362319,0.48940269749518295,127,276,243SheetSage1,summer_babe,0.2677165354330709,0.3285024154589372,0.2950108459869848,68,207,254SheetSage1,summertime_blues,0.6912442396313364,0.6198347107438017,0.6535947712418301,150,242,217SheetSage1,sunshine_of_your_love,0.3782051282051282,0.4521072796934866,0.41186736474694585,118,261,312SheetSage1,superstition,0.311787072243346,0.5942028985507246,0.4089775561097257,164,276,526SheetSage1,suspicious_minds,0.6289855072463768,0.48764044943820223,0.5493670886075949,217,445,345SheetSage1,sweet_child_o_mine,0.3131188118811881,0.6421319796954315,0.4209650582362729,253,394,808SheetSage1,sympathy_for_the_devil,0.4467455621301775,0.29206963249516443,0.3532163742690059,151,517,338SheetSage1,take_me_to_the_river,0.6022408963585434,0.6456456456456456,0.6231884057971014,215,333,357SheetSage1,tangled_up_in_blue,0.6297814207650273,0.6255088195386703,0.627637848876787,461,737,732SheetSage1,tears_in_heaven,0.680672268907563,0.8140703517587939,0.7414187643020594,162,199,238SheetSage1,thatll_be_the_day,0.32779097387173395,0.43125,0.3724696356275303,138,320,421SheetSage1,thats_all_right,0.4122448979591837,0.5519125683060109,0.47196261682242985,101,183,245SheetSage1,the_boxer,0.6766256590509666,0.7432432432432432,0.7083716651333947,385,518,569SheetSage1,the_dock_of_the_bay,0.6781115879828327,0.5808823529411765,0.6257425742574259,158,272,233SheetSage1,the_message,0.0,0.0,0.0,0,0,367SheetSage1,the_sounds_of_silence,0.7857142857142857,0.7385159010600707,0.761384335154827,209,283,266SheetSage1,the_times_they_are_a-changin,0.5666666666666667,0.3730407523510972,0.44990548204158787,119,319,210SheetSage1,the_tracks_of_my_tears,0.6612377850162866,0.6151515151515151,0.6373626373626373,203,330,307SheetSage1,the_weight,0.6882494004796164,0.7103960396039604,0.6991473812423873,287,404,417SheetSage1,thunder_road,0.6352,0.720508166969147,0.6751700680272109,397,551,625SheetSage1,tutti_frutti,0.4326647564469914,0.3793969849246231,0.40428380187416335,151,398,349SheetSage1,up_on_the_roof,0.7640449438202247,0.8869565217391304,0.8209255533199196,204,230,267SheetSage1,voodoo_child,0.10721649484536082,0.30952380952380953,0.15926493108728942,52,168,485SheetSage1,walk_on_by,0.7750865051903114,0.7671232876712328,0.7710843373493976,224,292,289SheetSage1,waterloo_sunset,0.557632398753894,0.7489539748953975,0.6392857142857142,179,239,321SheetSage1,whatd_i_say,0.25752508361204013,0.719626168224299,0.3793103448275862,154,214,598SheetSage1,whats_going_on,0.6818181818181818,0.5329949238578681,0.5982905982905983,210,394,308SheetSage1,when_a_man_loves_a_woman,0.4117647058823529,0.2202797202797203,0.2870159453302961,63,286,153SheetSage1,when_doves_cry,0.3637602179836512,0.5668789808917197,0.44315352697095434,267,471,734SheetSage1,while_my_guitar_gently_weeps,0.3314285714285714,0.6480446927374302,0.4385633270321361,116,179,350SheetSage1,who_do_you_love,0.47214854111405835,0.7206477732793523,0.5705128205128205,178,247,377SheetSage1,whole_lotta_love,0.44686648501362397,0.47126436781609193,0.45874125874125876,164,348,367SheetSage1,whole_lotta_shakin_goin_on,0.23140495867768596,0.2916666666666667,0.2580645161290323,84,288,363SheetSage1,will_you_love_me_tomorrow,0.6106194690265486,0.7301587301587301,0.6650602409638554,138,189,226SheetSage1,with_or_without_you,0.5227272727272727,0.828,0.6408668730650153,207,250,396SheetSage1,wont_get_fooled_again,0.25845620121422375,0.7321867321867321,0.382051282051282,298,407,1153SheetSage1,yesterday,0.8343558282208589,0.7555555555555555,0.7930029154518949,136,180,163SheetSage1,you_cant_always_get_what_you_want,0.5850144092219021,0.3717948717948718,0.45464725643896975,203,546,347SheetSage1,you_really_got_me,0.40298507462686567,0.41064638783269963,0.4067796610169492,108,263,268SheetSage1,you_send_me,0.3684210526315789,0.3462897526501767,0.3570127504553734,98,283,266SheetSage1,your_song,0.6835443037974683,0.5567010309278351,0.6136363636363636,216,388,316SheetSage1,youve_lost_that_lovin_feelin,0.5276872964169381,0.43548387096774194,0.4771723122238586,162,372,307SheetSage2-AR,1999,0.7589041095890411,0.47189097103918226,0.5819327731092437,277,587,365SheetSage2-AR,a_change_is_gonna_come,0.6607142857142857,0.4111111111111111,0.5068493150684932,111,270,168SheetSage2-AR,a_day_in_the_life,0.7471264367816092,0.8150470219435737,0.7796101949025488,260,319,348SheetSage2-AR,a_hard_days_night,0.8285714285714286,0.8529411764705882,0.8405797101449276,261,306,315SheetSage2-AR,a_whiter_shade_of_pale,0.6551724137931034,0.5732758620689655,0.6114942528735632,133,232,203SheetSage2-AR,all_along_the_watchtower,0.8333333333333334,0.8146067415730337,0.8238636363636364,145,178,174SheetSage2-AR,all_apologies,0.8493150684931506,0.8732394366197183,0.861111111111111,248,284,292SheetSage2-AR,all_i_have_to_do_is_dream,0.9073359073359073,0.94,0.9233791748526522,235,250,259SheetSage2-AR,anarchy_in_the_uk,0.7922705314009661,0.6776859504132231,0.7305122494432071,164,242,207SheetSage2-AR,back_in_black,0.8411552346570397,0.7818791946308725,0.8104347826086957,233,298,277SheetSage2-AR,be-bop-a-lula,0.65234375,0.6072727272727273,0.6290018832391714,167,275,256SheetSage2-AR,be_my_baby,0.5041666666666667,0.5475113122171946,0.5249457700650759,121,221,240SheetSage2-AR,billie_jean,0.0,0.0,0.0,0,509,540SheetSage2-AR,bitter_sweet_symphony,0.7199074074074074,0.6895787139689579,0.7044167610419027,311,451,432SheetSage2-AR,bizarre_love_triangle,0.5880681818181818,0.7840909090909091,0.672077922077922,207,264,352SheetSage2-AR,blitzkrieg_bop,0.7757847533632287,0.7792792792792793,0.7775280898876405,173,222,223SheetSage2-AR,blowin_in_the_wind,0.6991525423728814,0.7081545064377682,0.7036247334754797,165,233,236SheetSage2-AR,blue_suede_shoes,0.6254681647940075,0.6398467432950191,0.6325757575757575,167,261,267SheetSage2-AR,blueberry_hill,0.5454545454545454,0.5454545454545454,0.5454545454545454,78,143,143SheetSage2-AR,bo_diddley,0.8601398601398601,0.831081081081081,0.8453608247422679,123,148,143SheetSage2-AR,bohemian_rhapsody,0.6737044145873321,0.6512059369202227,0.6622641509433963,351,539,521SheetSage2-AR,born_to_be_wild,0.8339483394833949,0.8560606060606061,0.8448598130841121,226,264,271SheetSage2-AR,born_to_run,0.8686440677966102,0.8817204301075269,0.8751334044823906,410,465,472SheetSage2-AR,both_sides_now,0.8948948948948949,0.8816568047337278,0.8882265275707899,298,338,333SheetSage2-AR,bridge_over_troubled_water,0.7523364485981309,0.7155555555555555,0.733485193621868,161,225,214SheetSage2-AR,brown_eyed_girl,0.8475177304964538,0.8101694915254237,0.8284228769497402,239,295,282SheetSage2-AR,california_dreamin,0.49230769230769234,0.810126582278481,0.6124401913875599,128,158,260SheetSage2-AR,california_girls,0.425,0.4533333333333333,0.43870967741935485,102,225,240SheetSage2-AR,california_love,0.812206572769953,0.7330508474576272,0.7706013363028953,173,236,213SheetSage2-AR,cathys_clown,0.8854625550660793,0.8933333333333333,0.8893805309734514,201,225,227SheetSage2-AR,changes,0.7723342939481268,0.73224043715847,0.7517531556802244,268,366,347SheetSage2-AR,come_as_you_are,0.8528138528138528,0.8491379310344828,0.8509719222462203,197,232,231SheetSage2-AR,crazy,0.3356643356643357,0.2774566473988439,0.30379746835443033,48,173,143SheetSage2-AR,crying,0.8669724770642202,0.9264705882352942,0.8957345971563981,189,204,218SheetSage2-AR,da_doo_ron_ron,0.43209876543209874,0.3710247349823322,0.39923954372623577,105,283,243SheetSage2-AR,dancing_in_the_street,0.7614213197969543,0.8746355685131195,0.8141112618724559,300,343,394SheetSage2-AR,dancing_queen,0.838006230529595,0.893687707641196,0.864951768488746,269,301,321SheetSage2-AR,dont_worry_baby,0.7253521126760564,0.8879310344827587,0.7984496124031009,206,232,284SheetSage2-AR,dream_on,0.8688946015424165,0.8304668304668305,0.8492462311557789,338,407,389SheetSage2-AR,earth_angel,0.3288888888888889,0.2924901185770751,0.3096234309623431,74,253,225SheetSage2-AR,eight_miles_high,0.7647058823529411,0.8584905660377359,0.8088888888888889,91,106,119SheetSage2-AR,eleanor_rigby,0.9801587301587301,0.988,0.9840637450199202,247,250,252SheetSage2-AR,enter_sandman,0.8942307692307693,0.7948717948717948,0.8416289592760181,186,234,208SheetSage2-AR,every_breath_you_take,0.0,0.0,0.0,0,279,418SheetSage2-AR,everyday_people,0.8985507246376812,0.8732394366197183,0.8857142857142857,248,284,276SheetSage2-AR,fake_plastic_trees,0.9245283018867925,0.9032258064516129,0.9137529137529137,196,217,212SheetSage2-AR,family_affair,0.9587628865979382,0.33574007220216606,0.49732620320855614,93,277,97SheetSage2-AR,fast_car,0.9038759689922481,0.8846737481031867,0.8941717791411044,583,659,645SheetSage2-AR,folsom_prison_blues,0.1038961038961039,0.10212765957446808,0.10300429184549355,24,235,231SheetSage2-AR,for_what_its_worth,0.7849056603773585,0.7819548872180451,0.783427495291902,208,266,265SheetSage2-AR,fortunate_son,0.6506024096385542,0.6303501945525292,0.6403162055335968,162,257,249SheetSage2-AR,foxey_lady,0.0,0.0,0.0,0,0,26SheetSage2-AR,free_fallin,0.7518796992481203,0.8,0.7751937984496123,200,250,266SheetSage2-AR,georgia_on_my_mind,0.3490566037735849,0.18316831683168316,0.24025974025974023,37,202,106SheetSage2-AR,gimme_shelter,0.6932153392330384,0.8274647887323944,0.754414125200642,235,284,339SheetSage2-AR,go_your_own_way,0.8547008547008547,0.7604562737642585,0.8048289738430583,200,263,234SheetSage2-AR,god_only_knows,0.2976190476190476,0.38461538461538464,0.33557046979865773,75,195,252SheetSage2-AR,god_save_the_queen,0.0,0.0,0.0,0,0,205SheetSage2-AR,good_golly_miss_molly,0.7309236947791165,0.7583333333333333,0.7443762781186094,182,240,249SheetSage2-AR,good_vibrations,0.48184818481848185,0.45482866043613707,0.46794871794871795,146,321,303SheetSage2-AR,great_balls_of_fire,0.5976331360946746,0.39763779527559057,0.4775413711583924,101,254,169SheetSage2-AR,hallelujah,0.6480186480186481,0.6332574031890661,0.6405529953917051,278,439,429SheetSage2-AR,heartbreak_hotel,0.326271186440678,0.27017543859649124,0.2955854126679463,77,285,236SheetSage2-AR,help,0.8488372093023255,0.8821752265861027,0.8651851851851852,292,331,344SheetSage2-AR,heroes,0.7403846153846154,0.7451612903225806,0.7427652733118971,231,310,312SheetSage2-AR,hey_jude,0.7206405693950177,0.7627118644067796,0.7410795974382433,405,531,562SheetSage2-AR,honky_tonk_women,0.6021505376344086,0.6054054054054054,0.6037735849056605,112,185,186SheetSage2-AR,hot_stuff,0.8833333333333333,0.8907563025210085,0.8870292887029289,424,476,480SheetSage2-AR,hotel_california,0.801255230125523,0.8645598194130926,0.8317046688382193,383,443,478SheetSage2-AR,hound_dog,0.47307692307692306,0.46946564885496184,0.47126436781609193,123,262,260SheetSage2-AR,house_of_the_rising_sun,0.765,0.8010471204188482,0.7826086956521738,153,191,200SheetSage2-AR,i_believe_i_can_fly,0.7943722943722944,0.7112403100775194,0.7505112474437627,367,516,462SheetSage2-AR,i_cant_make_you_love_me,0.8715953307392996,0.8421052631578947,0.8565965583173996,224,266,257SheetSage2-AR,i_cant_stop_loving_you,0.348,0.2668711656441718,0.3020833333333333,87,326,250SheetSage2-AR,i_fought_the_law,0.8853211009174312,0.9368932038834952,0.910377358490566,193,206,218SheetSage2-AR,i_got_you,0.5613382899628253,0.5551470588235294,0.5582255083179297,151,272,269SheetSage2-AR,i_heard_it_through_the_grapevine,0.66,0.7927927927927928,0.7203274215552523,264,333,400SheetSage2-AR,i_only_have_eyes_for_you,0.4755244755244755,0.5271317829457365,0.5000000000000001,68,129,143SheetSage2-AR,i_saw_her_standing_there,0.7403100775193798,0.8197424892703863,0.7780040733197556,191,233,258SheetSage2-AR,i_still_havent_found_what_im_looking_for,0.9119718309859155,0.9452554744525548,0.9283154121863799,259,274,284SheetSage2-AR,i_walk_the_line,0.7692307692307693,0.7352941176470589,0.7518796992481205,150,204,195SheetSage2-AR,i_wanna_be_sedated,0.9537275064267352,0.9464285714285714,0.9500640204865557,371,392,389SheetSage2-AR,i_want_to_hold_your_hand,0.8634686346863468,0.9034749034749034,0.8830188679245283,234,259,271SheetSage2-AR,i_want_you_back,0.794425087108014,0.6826347305389222,0.7342995169082127,228,334,287SheetSage2-AR,im_so_lonesome_i_could_cry,0.4715447154471545,0.35365853658536583,0.40418118466898956,58,164,123SheetSage2-AR,im_waiting_for_the_man,0.6804123711340206,0.5477178423236515,0.606896551724138,132,241,194SheetSage2-AR,imagine,0.875,0.8590909090909091,0.8669724770642202,189,220,216SheetSage2-AR,in_bloom,0.9288135593220339,0.9547038327526133,0.9415807560137457,274,287,295SheetSage2-AR,in_my_life,0.8842592592592593,0.9095238095238095,0.8967136150234741,191,210,216SheetSage2-AR,in_the_midnight_hour,0.8214285714285714,0.4811715481171548,0.6068601583113457,115,239,140SheetSage2-AR,in_the_still_of_the_night,0.6683417085427136,0.6551724137931034,0.6616915422885572,133,203,199SheetSage2-AR,its_a_mans_mans_mans_world,0.6129032258064516,0.0811965811965812,0.14339622641509434,19,234,31SheetSage2-AR,ive_been_loving_you_too_long,0.6853932584269663,0.23552123552123552,0.3505747126436782,61,259,89SheetSage2-AR,jailhouse_rock,0.8054862842892768,0.8136020151133502,0.8095238095238095,323,397,401SheetSage2-AR,johnny_b_goode,0.8733766233766234,0.9180887372013652,0.8951747088186357,269,293,308SheetSage2-AR,jumpin_jack_flash,0.7389162561576355,0.7211538461538461,0.7299270072992701,150,208,203SheetSage2-AR,kashmir,0.5617021276595745,0.30697674418604654,0.3969924812030075,132,430,235SheetSage2-AR,layla,0.6142131979695431,0.4820717131474104,0.5401785714285714,121,251,197SheetSage2-AR,let_it_be,0.8209366391184573,0.873900293255132,0.8465909090909092,298,341,363SheetSage2-AR,lets_get_it_on,0.8156424581005587,0.29494949494949496,0.4332344213649852,146,495,179SheetSage2-AR,lets_stay_together,0.8614232209737828,0.7419354838709677,0.7972270363951472,230,310,267SheetSage2-AR,light_my_fire,0.7692307692307693,0.7421875,0.7554671968190856,190,256,247SheetSage2-AR,like_a_rolling_stone,0.7255520504731862,0.4637096774193548,0.5658056580565805,230,496,317SheetSage2-AR,little_red_corvette,0.7557077625570776,0.5766550522648084,0.6541501976284585,331,574,438SheetSage2-AR,living_for_the_city,0.5146831530139103,0.6283018867924528,0.5658453695836874,333,530,647SheetSage2-AR,london_calling,0.4011627906976744,0.39316239316239315,0.3971223021582734,138,351,344SheetSage2-AR,long_tall_sally,0.7813504823151125,0.7546583850931677,0.7677725118483412,243,322,311SheetSage2-AR,lose_yourself,0.0,0.0,0.0,0,303,0SheetSage2-AR,loser,0.8947368421052632,0.9444444444444444,0.918918918918919,136,144,152SheetSage2-AR,losing_my_religion,0.8865671641791045,0.928125,0.9068702290076337,297,320,335SheetSage2-AR,louie_louie,0.8,0.7719298245614035,0.7857142857142858,220,285,275SheetSage2-AR,love_and_happiness,0.7572815533980582,0.18013856812933027,0.291044776119403,78,433,103SheetSage2-AR,love_will_tear_us_apart,0.8315217391304348,0.8360655737704918,0.8337874659400545,153,183,184SheetSage2-AR,lust_for_life,0.48055555555555557,0.43467336683417085,0.45646437994722955,173,398,360SheetSage2-AR,maggie_may,0.8407960199004975,0.8535353535353535,0.8471177944862155,338,396,402SheetSage2-AR,maybellene,0.5965909090909091,0.5570291777188329,0.5761316872427983,210,377,352SheetSage2-AR,me_and_bobby_mcgee,0.8072916666666666,0.8303571428571429,0.8186619718309859,465,560,576SheetSage2-AR,mr_tambourine_man_byrds,0.6181818181818182,0.6476190476190476,0.6325581395348837,136,210,220SheetSage2-AR,mr_tambourine_man_dylan,0.7260869565217392,0.8041733547351525,0.7631378522467631,501,623,690SheetSage2-AR,my_generation,0.3377049180327869,0.4256198347107438,0.37659963436928706,103,242,305SheetSage2-AR,my_girl,0.7558139534883721,0.4868913857677903,0.592255125284738,130,267,172SheetSage2-AR,mystery_train,0.7325581395348837,0.7241379310344828,0.7283236994219654,126,174,172SheetSage2-AR,no_woman_no_cry,0.8328690807799443,0.8542857142857143,0.8434414668547249,299,350,359SheetSage2-AR,norwegian_wood,0.927536231884058,0.9552238805970149,0.9411764705882353,128,134,138SheetSage2-AR,not_fade_away,0.7866666666666666,0.6982248520710059,0.7398119122257053,118,169,150SheetSage2-AR,nothing_compares_2_u,0.5936507936507937,0.5649546827794562,0.5789473684210525,187,331,315SheetSage2-AR,nuthin_but_a_g_thang,0.0,0.0,0.0,0,0,0SheetSage2-AR,one,0.636963696369637,0.6069182389937107,0.6215780998389694,193,318,303SheetSage2-AR,paint_it_black,0.6914285714285714,0.5365853658536586,0.6042446941323346,242,451,350SheetSage2-AR,papa_was_a_rollin_stone,0.7621621621621621,0.5340909090909091,0.6280623608017818,282,528,370SheetSage2-AR,papas_got_a_brand_new_bag,0.7185929648241206,0.6163793103448276,0.6635730858468678,143,232,199SheetSage2-AR,paranoid_android,0.8905472636815921,0.7682403433476395,0.8248847926267282,179,233,201SheetSage2-AR,people_get_ready,0.8027210884353742,0.6082474226804123,0.6920821114369501,118,194,147SheetSage2-AR,please_please_please,0.5833333333333334,0.25,0.35000000000000003,70,280,120SheetSage2-AR,proud_mary,0.8600823045267489,0.9126637554585153,0.8855932203389831,209,229,243SheetSage2-AR,purple_haze,0.65625,0.6237623762376238,0.6395939086294415,63,101,96SheetSage2-AR,purple_rain,0.7047619047619048,0.20728291316526612,0.3203463203463204,74,357,105SheetSage2-AR,rave_on,0.8597285067873304,0.852017937219731,0.855855855855856,190,223,221SheetSage2-AR,redemption_song,0.8566775244299675,0.9131944444444444,0.884033613445378,263,288,307SheetSage2-AR,respect,0.29615384615384616,0.3130081300813008,0.3043478260869565,77,246,260SheetSage2-AR,ring_of_fire,0.897196261682243,0.8609865470852018,0.8787185354691077,192,223,214SheetSage2-AR,river_deep_mountain_high,0.6543535620052771,0.6888888888888889,0.6711772665764546,248,360,379SheetSage2-AR,rock_and_roll_music,0.8738532110091743,0.8542600896860987,0.8639455782312925,381,446,436SheetSage2-AR,rock_around_the_clock,0.6833333333333333,0.68561872909699,0.684474123539232,205,299,300SheetSage2-AR,rock_lobster,0.0,0.0,0.0,0,0,335SheetSage2-AR,rockin_in_the_free_world,0.9711538461538461,0.964968152866242,0.9680511182108625,303,314,312SheetSage2-AR,roll_over_beethoven,0.6377708978328174,0.6204819277108434,0.6290076335877863,206,332,323SheetSage2-AR,sabotage,0.0,0.0,0.0,0,0,0SheetSage2-AR,satisfaction,0.8242074927953891,0.8056338028169014,0.8148148148148148,286,355,347SheetSage2-AR,september_gurls,0.8407960199004975,0.8492462311557789,0.845,169,199,201SheetSage2-AR,shake_rattle_and_roll,0.5574324324324325,0.5254777070063694,0.5409836065573771,165,314,296SheetSage2-AR,she_loves_you,0.898876404494382,0.9195402298850575,0.9090909090909091,240,261,267SheetSage2-AR,should_i_stay_or_should_i_go,0.708904109589041,0.7366548042704626,0.7225130890052355,207,281,292SheetSage2-AR,shout,0.5315934065934066,0.49174078780177893,0.510891089108911,387,787,728SheetSage2-AR,smells_like_teen_spirit,0.9673366834170855,0.9722222222222222,0.9697732997481109,385,396,398SheetSage2-AR,stairway_to_heaven,0.7913832199546486,0.7301255230125523,0.7595212187159956,349,478,441SheetSage2-AR,stand_by_me,0.7772511848341233,0.7130434782608696,0.743764172335601,164,230,211SheetSage2-AR,strawberry_fields_forever,0.8103448275862069,0.8514492753623188,0.8303886925795053,235,276,290SheetSage2-AR,summer_babe,0.8424242424242424,0.6714975845410628,0.7473118279569892,139,207,165SheetSage2-AR,summertime_blues,0.7619047619047619,0.7933884297520661,0.7773279352226721,192,242,252SheetSage2-AR,sunshine_of_your_love,0.7318007662835249,0.7318007662835249,0.7318007662835249,191,261,261SheetSage2-AR,superstition,0.8181818181818182,0.5217391304347826,0.6371681415929203,144,276,176SheetSage2-AR,suspicious_minds,0.7668161434977578,0.7685393258426966,0.7676767676767675,342,445,446SheetSage2-AR,sweet_child_o_mine,0.8835978835978836,0.8477157360406091,0.8652849740932643,334,394,378SheetSage2-AR,sympathy_for_the_devil,0.6666666666666666,0.4912959381044487,0.5657015590200445,254,517,381SheetSage2-AR,take_me_to_the_river,0.8867313915857605,0.8228228228228228,0.853582554517134,274,333,309SheetSage2-AR,tangled_up_in_blue,0.732620320855615,0.7435549525101763,0.7380471380471381,548,737,748SheetSage2-AR,tears_in_heaven,0.9581151832460733,0.9195979899497487,0.9384615384615383,183,199,191SheetSage2-AR,thatll_be_the_day,0.43729903536977494,0.425,0.4310618066561014,136,320,311SheetSage2-AR,thats_all_right,0.8223350253807107,0.8852459016393442,0.8526315789473684,162,183,197SheetSage2-AR,the_boxer,0.9292364990689013,0.9633204633204633,0.9459715639810427,499,518,537SheetSage2-AR,the_dock_of_the_bay,0.8582995951417004,0.7794117647058824,0.8169556840077071,212,272,247SheetSage2-AR,the_message,0.0,0.0,0.0,0,0,0SheetSage2-AR,the_sounds_of_silence,0.9428571428571428,0.9328621908127208,0.9378330373001776,264,283,280SheetSage2-AR,the_times_they_are_a-changin,0.7286063569682152,0.9341692789968652,0.8186813186813187,298,319,409SheetSage2-AR,the_tracks_of_my_tears,0.6129032258064516,0.5757575757575758,0.59375,190,330,310SheetSage2-AR,the_weight,0.9101941747572816,0.9282178217821783,0.9191176470588236,375,404,412SheetSage2-AR,thunder_road,0.8683760683760684,0.9219600725952813,0.8943661971830986,508,551,585SheetSage2-AR,tutti_frutti,0.42857142857142855,0.39195979899497485,0.4094488188976378,156,398,364SheetSage2-AR,up_on_the_roof,0.8524590163934426,0.9043478260869565,0.8776371308016878,208,230,244SheetSage2-AR,voodoo_child,0.76,0.2261904761904762,0.3486238532110092,38,168,50SheetSage2-AR,walk_on_by,0.8762886597938144,0.8732876712328768,0.8747855917667239,255,292,291SheetSage2-AR,waterloo_sunset,0.9053497942386831,0.9205020920502092,0.9128630705394191,220,239,243SheetSage2-AR,whatd_i_say,0.8394495412844036,0.8551401869158879,0.8472222222222222,183,214,218SheetSage2-AR,whats_going_on,0.7490636704119851,0.5076142131979695,0.6051437216338881,200,394,267SheetSage2-AR,when_a_man_loves_a_woman,0.6547619047619048,0.5769230769230769,0.6133828996282528,165,286,252SheetSage2-AR,when_doves_cry,0.8297213622291022,0.5690021231422505,0.6750629722921914,268,471,323SheetSage2-AR,while_my_guitar_gently_weeps,0.8350515463917526,0.9050279329608939,0.868632707774799,162,179,194SheetSage2-AR,who_do_you_love,0.8765432098765432,0.8623481781376519,0.8693877551020408,213,247,243SheetSage2-AR,whole_lotta_love,0.6850393700787402,0.5,0.5780730897009966,174,348,254SheetSage2-AR,whole_lotta_shakin_goin_on,0.4353448275862069,0.3506944444444444,0.38846153846153847,101,288,232SheetSage2-AR,will_you_love_me_tomorrow,0.9033816425120773,0.9894179894179894,0.9444444444444445,187,189,207SheetSage2-AR,with_or_without_you,0.9539748953974896,0.912,0.9325153374233129,228,250,239SheetSage2-AR,wont_get_fooled_again,0.884318766066838,0.8452088452088452,0.864321608040201,344,407,389SheetSage2-AR,yesterday,0.8950276243093923,0.9,0.8975069252077562,162,180,181SheetSage2-AR,you_cant_always_get_what_you_want,0.7467889908256881,0.7454212454212454,0.7461044912923922,407,546,545SheetSage2-AR,you_really_got_me,0.19771863117870722,0.19771863117870722,0.19771863117870725,52,263,263SheetSage2-AR,you_send_me,0.3147410358565737,0.2791519434628975,0.2958801498127341,79,283,251SheetSage2-AR,your_song,0.7546174142480211,0.7371134020618557,0.7457627118644068,286,388,379SheetSage2-AR,youve_lost_that_lovin_feelin,0.6263736263736264,0.6129032258064516,0.6195652173913044,228,372,36412345678910111213141516171819202122232425262728293031323334353637{ "dataset": "Rock Corpus (RS 200)", "task": "vocal melody transcription", "tracks": 200, "metric": "onset_pitch_class_note_F1", "protocol": { "onset_tolerance_seconds": 0.05, "pitch_tolerance_cents": 50, "pitch_mode": "MIDI modulo 12", "offset_matching": false, "aggregation": "macro_average_over_all_200_recordings", "empty_reference_tracks": 6, "empty_reference_f1": 0, "time_alignment": false, "annotation_correction": false, "dataset_tuning": false }, "reference_url": "https://rockcorpus.midside.com/melodic_transcriptions.html", "models": { "SheetSage1": { "vocal_pitch_class_F1_percent": 49.187611626228076, "macro_precision": 0.48822614214813176, "macro_recall": 0.5260359171647316, "matched_notes": 32337, "reference_notes": 59591, "estimated_notes": 69935 }, "SheetSage2-AR": { "vocal_pitch_class_F1_percent": 67.07513352928562, "macro_precision": 0.6997741783959895, "macro_recall": 0.659468737829881, "matched_notes": 40231, "reference_notes": 59591, "estimated_notes": 56059 } }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122"""Score ChordFormer predictions on the frozen SheetSage2 chord cohorts.
Scoring functions are preserved from the audited SheetSage2 evaluator.Requires numpy==1.26.4, scipy==1.13.1, mir_eval==0.7."""from pathlib import Pathimport argparse, csv, hashlib, json, warningsimport numpy as npnp.int = intnp.float = floatimport mir_eval.chord, mir_eval.ioMETRIC_KEYS = ["root", "majmin", "majmin7", "tetrads", "sevenths"]
def load_chord_lab(path: Path): intervals, labels = mir_eval.io.load_labeled_intervals(str(path)) return sanitize_chord_intervals(intervals, labels)
def sanitize_chord_intervals(intervals, labels): intervals = np.asarray(intervals, dtype=np.float64) if intervals.size == 0 or intervals.ndim != 2 or intervals.shape[1] != 2: raise ValueError("No valid chord intervals after sanitizing.") order = np.argsort(intervals[:, 0], kind="stable") cleaned_intervals = [] cleaned_labels = [] last_end = None for index in order: start, end = (float(value) for value in intervals[index]) if not np.isfinite(start) or not np.isfinite(end) or end <= start: continue start = max(0.0, start) end = max(0.0, end) if end <= start: continue if last_end is not None and start < last_end: start = last_end if end <= start: continue cleaned_intervals.append([start, end]) cleaned_labels.append(labels[index]) last_end = end if not cleaned_intervals: raise ValueError("No valid chord intervals after sanitizing.") return np.asarray(cleaned_intervals, dtype=np.float64), cleaned_labels
def crop_chord_intervals(intervals, labels, start: float, end: float): cropped_intervals = [] cropped_labels = [] for (interval_start, interval_end), label in zip(intervals, labels): interval_start = max(float(interval_start), start) interval_end = min(float(interval_end), end) if interval_end <= interval_start: continue cropped_intervals.append([interval_start, interval_end]) cropped_labels.append(label) if not cropped_intervals: return np.asarray([[start, end]], dtype=np.float64), ["N"] return np.asarray(cropped_intervals, dtype=np.float64), cropped_labels
def evaluate_one(ref_path: Path, est_path: Path) -> dict: ref_intervals, ref_labels = load_chord_lab(ref_path) est_intervals, est_labels = load_chord_lab(est_path) est_intervals, est_labels = crop_chord_intervals( est_intervals, est_labels, float(ref_intervals.min()), float(ref_intervals.max()), ) scores = mir_eval.chord.evaluate(ref_intervals, ref_labels, est_intervals, est_labels) duration = float(ref_intervals.max() - ref_intervals.min()) return { "duration": duration, "root": float(scores["root"]), "majmin": float(scores["majmin"]), "majmin7": float(scores["sevenths"]), "tetrads": float(scores["tetrads"]), "sevenths": float(scores["sevenths"]), }
def summarize(rows: list[dict]) -> dict: durations = np.asarray([row["duration"] for row in rows], dtype=np.float64) total_duration = float(np.sum(durations)) summary = { "n": len(rows), "total_duration": total_duration, } for key in METRIC_KEYS: values = np.asarray([row[key] for row in rows], dtype=np.float64) summary[f"{key}_macro"] = float(np.mean(values)) if len(values) else float("nan") summary[key] = float(np.sum(values * durations) / total_duration) if total_duration > 0 else float("nan") return summary
def main(): p=argparse.ArgumentParser(description=__doc__) p.add_argument('--dataset',choices=['osu2017','Chords1217'],required=True) p.add_argument('--reference',type=Path,required=True) p.add_argument('--predictions',type=Path,required=True) p.add_argument('--cohort',type=Path,default=Path(__file__).with_name('chordformer_per_song.csv')) p.add_argument('--verify-archived-predictions',action='store_true') args=p.parse_args() with args.cohort.open(encoding='utf-8') as f: cohort=[r for r in csv.DictReader(f) if r['dataset']==args.dataset] count={'osu2017':142,'Chords1217':1217}[args.dataset] if len(cohort)!=count or len({r['sample_id'] for r in cohort})!=count: raise ValueError('Incomplete or duplicated cohort') rows=[] for r in cohort: ref=args.reference/(r['sample_id']+'.lab') pred=args.predictions/(r['sample_id']+'.lab') if hashlib.sha256(ref.read_bytes()).hexdigest()!=r['reference_sha256']: raise ValueError('Reference differs from frozen cohort: '+r['sample_id']) if args.verify_archived_predictions and hashlib.sha256(pred.read_bytes()).hexdigest()!=r['prediction_sha256']: raise ValueError('Prediction differs from archive: '+r['sample_id']) with warnings.catch_warnings(): warnings.simplefilter('ignore') rows.append(evaluate_one(ref,pred)) result=summarize(rows) result['dataset']=args.dataset result['majmin_percent']=100*result['majmin'] print(json.dumps(result,indent=2))
if __name__=='__main__': main()123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196"""Local-key chord spelling, ported from SheetSage2 LM."""import numpy as npimport mir_eval.chord
KEY_MAP = [ ['C:major', 'Db:major', 'D:major', 'Eb:major', 'E:major', 'F:major', 'F#:major', 'G:major', 'Ab:major', 'A:major', 'Bb:major', 'B:major'], ['D:dorian', 'Eb:dorian', 'E:dorian', 'F:dorian', 'F#:dorian', 'G:dorian', 'G#:dorian', 'A:dorian', 'Bb:dorian', 'B:dorian', 'C:dorian', 'C#:dorian'], ['E:phrygian', 'F:phrygian', 'F#:phrygian', 'G:phrygian', 'G#:phrygian', 'A:phrygian', 'A#:phrygian', 'B:phrygian', 'C:phrygian', 'C#:phrygian', 'D:phrygian', 'D#:phrygian'], ['F:lydian', 'Gb:lydian', 'G:lydian', 'Ab:lydian', 'A:lydian', 'Bb:lydian', 'B:lydian', 'C:lydian', 'Db:lydian', 'D:lydian', 'Eb:lydian', 'E:lydian'], ['G:mixolydian', 'Ab:mixolydian', 'A:mixolydian', 'Bb:mixolydian', 'B:mixolydian', 'C:mixolydian', 'C#:mixolydian', 'D:mixolydian', 'Eb:mixolydian', 'E:mixolydian', 'F:mixolydian', 'F#:mixolydian'], ['A:minor', 'Bb:minor', 'B:minor', 'C:minor', 'C#:minor', 'D:minor', 'D#:minor', 'E:minor', 'F:minor', 'F#:minor', 'G:minor', 'G#:minor'], ['B:locrian', 'C:locrian', 'C#:locrian', 'D:locrian', 'D#:locrian', 'E:locrian', 'E#:locrian', 'F#:locrian', 'G:locrian', 'G#:locrian', 'A:locrian', 'A#:locrian']]
MODE_NAMES = ['major', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'minor', 'locrian']MODE_STARTS = [0, 2, 4, 5, 7, 9, 11]
QUALITIES = { # 1 2 3 4 5 6 7 'maj': [2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], 'min': [2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0], 'aug': [2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0], 'dim': [2, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0], 'sus4': [2, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0], 'sus4(b7)':[2, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0], 'sus4(b7,9)':[2, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0], 'sus2': [2, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0], '7': [2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], 'maj7': [2, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1], 'min7': [2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0], 'minmaj7': [2, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1], 'maj6': [2, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0], 'min6': [2, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0], '9': [2, 0, 1, 0, 1, 0, 0, 1, 0, 0, 1, 0], 'maj9': [2, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1], 'min9': [2, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0], '7(b9)': [2, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0], '7(#9)': [2, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0], 'maj6(9)': [2, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0], 'min6(9)': [2, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0], 'maj(9)': [2, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0], 'min(9)': [2, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0], 'maj(11)': [2, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1], 'min(11)': [2, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1], '11': [2, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0], 'maj9(11)':[2, 0, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1], 'min11': [2, 0, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0], '13': [2, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0], 'maj13': [2, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1], 'min13': [2, 0, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0], 'dim7': [2, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0], 'hdim7': [2, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0], #'5': [2, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0] }DEFAULT_SPELLING = ['1', 'b2', '2', 'b3', '3', '4', 'b5', '5', '#5', '6', 'b7', '7']CHORD_SPELLING_TABLE = NoneCIRCLE_OF_FIFTH = np.array([3, 0, 5, 1, 6, 2, 7])CIRCLE_OF_FIFTH_INV = np.array([1, 3, 5, 0, 2, 4, 6])NOTE_NAMES = 'CDEFGAB'
def scale_degree_to_tuple(scale_degree): offset = 0 if scale_degree.startswith("#"): offset = scale_degree.count("#") scale_degree = scale_degree.strip("#") elif scale_degree.startswith("b"): offset = -1 * scale_degree.count("b") scale_degree = scale_degree.strip("b") return np.array([int(scale_degree) - 1, offset], dtype=int)
def note_name_to_tuple(note_name): scale_degree = NOTE_NAMES.index(note_name[0]) offset = 0 if note_name.endswith("#"): offset = note_name.count("#") elif note_name.endswith("b"): offset = -1 * note_name.count("b") return np.array([scale_degree, offset], dtype=int)
def scale_degrees_to_tuple(scale_degrees): return np.stack([scale_degree_to_tuple(sd) for sd in scale_degrees], axis=0)
def get_chord_spelling_table(): global CHORD_SPELLING_TABLE if CHORD_SPELLING_TABLE is not None: return CHORD_SPELLING_TABLE chord_spelling_table = {} for quality in QUALITIES: quality_spelling = [] chroma = QUALITIES[quality] for i in range(12): if chroma[i] > 0: if '#9' in quality and i == DEFAULT_SPELLING.index('b3'): quality_spelling.append('#2') elif 'dim7' in quality and i == DEFAULT_SPELLING.index('6'): quality_spelling.append('bb7') else: quality_spelling.append(DEFAULT_SPELLING[i]) chord_spelling_table[quality] = scale_degrees_to_tuple(quality_spelling) CHORD_SPELLING_TABLE = chord_spelling_table return chord_spelling_table
# Circle-of-fifths offsets of major-scale degrees 1-7 from the tonic.MAJOR_SCALE_FIFTHS = np.array([0, 2, 4, -1, 1, 3, 5])
def spell_chord_tones(root_spelling, quality): ''' Spell every chord tone from a root spelling. Template intervals are relative to the root's own major scale, so adding them on the circle of fifths keeps each tone's pitch class; e.g., E:maj gives E, G#, B, and Db:hdim7 gives Db, Fb, Abb, Cb. :param root_spelling: Numpy array of shape (2,) with note letter id and accidental offset. :param quality: Chord quality in QUALITIES. :return: Numpy array of shape (N, 2); the first row is the root. ''' intervals = get_chord_spelling_table()[quality] letters = (root_spelling[0] + intervals[:, 0]) % 7 root_pos = CIRCLE_OF_FIFTH_INV[root_spelling[0]] + root_spelling[1] * 7 tone_pos = root_pos + MAJOR_SCALE_FIFTHS[intervals[:, 0]] + intervals[:, 1] * 7 return np.stack([letters, (tone_pos - CIRCLE_OF_FIFTH_INV[letters]) // 7], axis=1)
def score_spelling_under_key(spelling, key): ''' Score the chord spelling under a given key. :param spelling: Numpy array of shape (N, 2) :param key: Numpy array of shape (2,) representing the degree of 1 (DO) :return: Score of the chord spelling under the key. ''' key_pos = CIRCLE_OF_FIFTH_INV[key[0]] + key[1] * 7 spelling_pos = CIRCLE_OF_FIFTH_INV[spelling[:, 0] % 7] + spelling[:, 1] * 7 relative_pos = np.clip(np.abs((spelling_pos - (key_pos + 2))) - 3, 0, None) return np.sum(relative_pos) + np.sum(relative_pos[:1]) * 1.0 # root matters more
def normalize_key_name(key_name): """Use the same canonical tonal spelling as SheetSage2 LM/NoLM.""" tonic, mode = key_name.split(':') mode_id = MODE_NAMES.index(mode) scale = (mir_eval.chord.pitch_class_to_semitone(tonic) - MODE_STARTS[mode_id]) % 12 return KEY_MAP[mode_id][scale]
def correct_chord_spelling(label, key_name): if label == 'N' or label == 'X': return label key_tonal, key_mode = key_name.split(':') key_mode = MODE_NAMES.index(key_mode) scale_semitone = (mir_eval.chord.pitch_class_to_semitone(key_tonal) - MODE_STARTS[key_mode]) % 12 # Tokenizer keys use sharps; map enharmonic aliases to the LM key signature. key_spelling = note_name_to_tuple(KEY_MAP[0][scale_semitone].split(':')[0]) # Ignore all inversions inversion = '' if '/' in label: label, inversion = label.split('/') # Separate quality and root root, quality = label.split(':') root_semitone = mir_eval.chord.pitch_class_to_semitone(root) scores = [] for possible_root_id in range(7): possible_root = NOTE_NAMES[possible_root_id] root_spelling = np.array([ possible_root_id, (root_semitone - mir_eval.chord.pitch_class_to_semitone(possible_root) + 6) % 12 - 6 ]) chord_spelling = spell_chord_tones(root_spelling, quality) scores.append(score_spelling_under_key(chord_spelling, key_spelling)) best_root_id = np.argmin(scores) best_root = NOTE_NAMES[best_root_id] best_root_spelling = np.array([ best_root_id, (root_semitone - mir_eval.chord.pitch_class_to_semitone(best_root) + 6) % 12 - 6 ]) if best_root_spelling[1] < 0: best_root = best_root + 'b' * abs(best_root_spelling[1]) else: best_root = best_root + '#' * best_root_spelling[1] if inversion: return f"{best_root}:{quality}/{inversion}" else: return f"{best_root}:{quality}"
def correct_chord_rows(chords, keys): """Use the local key at each chord midpoint, as in SheetSage2 LM.
Match LM's left-boundary tie rule. Extend the first/last decoded key to uncovered edges. Without a decoded key, preserve the original spelling. Return new rows without changing event values, timing, quality or inversion. """ if not keys: return [list(row) for row in chords] boundaries = np.array([row[1] for row in keys[:-1]]) return [[start, end, correct_chord_spelling( label, keys[np.searchsorted(boundaries, (start + end) / 2.0)][2])] for start, end, label in chords]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475{ "architectures": [ "SheetSage2Model" ], "auto_map": { "AutoConfig": "configuration_sheetsage2.SheetSage2Config", "AutoModel": "modeling_sheetsage2.SheetSage2Model", "AutoModelForSeq2SeqLM": "modeling_sheetsage2.SheetSage2Model", "AutoProcessor": "processing_sheetsage2.SheetSage2Processor" }, "backbone_config": { "architectures": [ "MERT2Model" ], "context_seconds": 360.0, "conv_depthwise_kernel_size": 31, "frame_rate": 25.0, "hidden_size": 1024, "hop_length": 240, "initializer_range": 0.02, "inputs_to_logits_ratio": 960, "intermediate_size": 4096, "layer_norm_eps": 1e-05, "minimum_input_samples": 1025, "model_type": "mert2", "n_fft": 2048, "num_attention_heads": 16, "num_hidden_layers": 24, "num_mel_bins": 128, "rotary_embedding_base": 10000, "sampling_rate": 24000, "subsampling_channels": [ 128, 512, 1024 ], "subsampling_depths": [ 3, 4, 5 ], "subsampling_layer_norm_eps": 1e-06, "torch_dtype": "float32", "transformers_version": "4.53.2", "variant": "fs", "win_length": 2048 }, "base_model_name_or_path": "m-a-p/MERT-v2-FullSong", "base_model_revision": "d8ba1c745e733b3908ce6ad16ebeb17ac7600a42", "base_model_sha256": "e6dd2ab187d6dd62b6521cd7d8f932e237acf0c5757745a7232082e28391350d", "bos_token_id": 1, "decoder_dropout": 0.1, "decoder_layers": 6, "decoder_start_token_id": 1, "encoder_attn_implementation": "sdpa", "eos_token_id": 2, "hidden_size": 512, "input_audio_length": 300.0, "intermediate_size": 2048, "is_encoder_decoder": true, "lora_alpha": 128.0, "lora_rank": 64, "max_output_seq_len": 5120, "model_type": "sheetsage2", "num_attention_heads": 8, "pad_token_id": 0, "sampling_rate": 24000, "time_hz": 100, "tokenizer_fingerprint": "5ba3325af0344c7f", "tokenizer_schema_version": "v1", "transformers_version": "4.45.2", "use_cache": true, "vocab_size": 31678, "weights_format": "adapter"}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576"""Configuration for MERT2 music representation models."""
from transformers import PretrainedConfig
class MERT2Config(PretrainedConfig): """Architecture shared by the 30-second and full-song MERT2 encoders."""
model_type = "mert2"
def __init__( self, hidden_size=1024, intermediate_size=4096, num_hidden_layers=24, num_attention_heads=16, num_mel_bins=128, sampling_rate=24000, n_fft=2048, win_length=2048, hop_length=240, subsampling_channels=None, subsampling_depths=None, conv_depthwise_kernel_size=31, rotary_embedding_base=10000, layer_norm_eps=1e-5, subsampling_layer_norm_eps=1e-6, initializer_range=0.02, variant="30s", context_seconds=None, **kwargs, ): super().__init__(**kwargs) self.hidden_size = int(hidden_size) self.intermediate_size = int(intermediate_size) self.num_hidden_layers = int(num_hidden_layers) self.num_attention_heads = int(num_attention_heads) self.num_mel_bins = int(num_mel_bins) self.sampling_rate = int(sampling_rate) self.n_fft = int(n_fft) self.win_length = int(win_length) self.hop_length = int(hop_length) self.subsampling_channels = list(subsampling_channels or [num_mel_bins, 512, hidden_size]) self.subsampling_depths = list(subsampling_depths or [3, 4, 5]) self.conv_depthwise_kernel_size = int(conv_depthwise_kernel_size) self.rotary_embedding_base = int(rotary_embedding_base) self.layer_norm_eps = float(layer_norm_eps) self.subsampling_layer_norm_eps = float(subsampling_layer_norm_eps) self.initializer_range = float(initializer_range) self.variant = str(variant) self.context_seconds = float(context_seconds if context_seconds is not None else (360 if variant == "fs" else 30)) self.inputs_to_logits_ratio = self.hop_length * 4 self.frame_rate = self.sampling_rate / self.inputs_to_logits_ratio self.minimum_input_samples = self.n_fft // 2 + 1
if min(self.hidden_size, self.intermediate_size, self.num_hidden_layers, self.num_attention_heads) <= 0: raise ValueError("Encoder dimensions and layer counts must be positive.") if self.hidden_size % self.num_attention_heads or (self.hidden_size // self.num_attention_heads) % 2: raise ValueError("hidden_size must divide into an even head dimension.") if len(self.subsampling_channels) != 3 or len(self.subsampling_depths) != 3: raise ValueError("The subsampler must contain three channel widths and three depths.") if self.subsampling_channels[0] != self.num_mel_bins or self.subsampling_channels[-1] != self.hidden_size: raise ValueError("Subsampling widths must start at num_mel_bins and end at hidden_size.") if min(*self.subsampling_channels, *self.subsampling_depths, self.num_mel_bins, self.sampling_rate, self.hop_length) <= 0: raise ValueError("Frontend dimensions and sampling parameters must be positive.") if self.n_fft < self.win_length or self.win_length <= 0 or self.n_fft % 2: raise ValueError("n_fft must be even and at least win_length > 0.") if self.conv_depthwise_kernel_size <= 0 or self.conv_depthwise_kernel_size % 2 != 1: raise ValueError("conv_depthwise_kernel_size must be positive and odd.") if self.rotary_embedding_base <= 0 or min(self.layer_norm_eps, self.subsampling_layer_norm_eps) <= 0: raise ValueError("Rotary base and normalization epsilons must be positive.") if self.variant not in {"30s", "fs"}: raise ValueError("variant must be '30s' or 'fs'.")
MERT2Config.register_for_auto_class()12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788"""Configuration for SheetSage2 audio-to-symbolic transcription."""
from transformers import PretrainedConfig
from .configuration_mert2 import MERT2Config
class SheetSage2Config(PretrainedConfig): model_type = "sheetsage2"
def __init__( self, vocab_size=31678, hidden_size=512, decoder_layers=6, num_attention_heads=8, intermediate_size=2048, decoder_dropout=0.1, input_audio_length=300.0, max_output_seq_len=5120, time_hz=100, sampling_rate=24000, lora_rank=64, lora_alpha=128, weights_format="adapter", backbone_config=None, encoder_attn_implementation="sdpa", base_model_name_or_path="m-a-p/MERT-v2-FullSong", base_model_revision="d8ba1c745e733b3908ce6ad16ebeb17ac7600a42", base_model_sha256="e6dd2ab187d6dd62b6521cd7d8f932e237acf0c5757745a7232082e28391350d", tokenizer_schema_version="v1", tokenizer_fingerprint="5ba3325af0344c7f", **kwargs, ): for name, default in ( ("is_encoder_decoder", True), ("tie_word_embeddings", True), ("pad_token_id", 0), ("bos_token_id", 1), ("eos_token_id", 2), ("decoder_start_token_id", 1), ("use_cache", True), ): kwargs.setdefault(name, default) super().__init__(**kwargs) self.vocab_size = int(vocab_size) self.hidden_size = int(hidden_size) self.decoder_layers = int(decoder_layers) self.num_attention_heads = int(num_attention_heads) self.intermediate_size = int(intermediate_size) self.decoder_dropout = float(decoder_dropout) self.input_audio_length = float(input_audio_length) self.max_output_seq_len = int(max_output_seq_len) self.time_hz = int(time_hz) self.sampling_rate = int(sampling_rate) self.lora_rank = int(lora_rank) self.lora_alpha = float(lora_alpha) self.weights_format = str(weights_format) self.backbone_config = dict(backbone_config or MERT2Config(variant="fs").to_dict()) self.backbone_config.pop("_name_or_path", None) self.backbone_config.pop("auto_map", None) self.encoder_attn_implementation = str(encoder_attn_implementation) self.base_model_name_or_path = str(base_model_name_or_path) self.base_model_revision = str(base_model_revision) self.base_model_sha256 = str(base_model_sha256) self.tokenizer_schema_version = str(tokenizer_schema_version) self.tokenizer_fingerprint = str(tokenizer_fingerprint) self.architectures = ["SheetSage2Model"] self.auto_map = { "AutoConfig": "configuration_sheetsage2.SheetSage2Config", "AutoModel": "modeling_sheetsage2.SheetSage2Model", "AutoModelForSeq2SeqLM": "modeling_sheetsage2.SheetSage2Model", "AutoProcessor": "processing_sheetsage2.SheetSage2Processor", } if self.weights_format not in {"adapter", "merged"}: raise ValueError("weights_format must be 'adapter' or 'merged'.") if self.encoder_attn_implementation not in {"sdpa", "flash_attention_2"}: raise ValueError("Select encoder attention 'sdpa' or 'flash_attention_2'.") if min(self.vocab_size, self.hidden_size, self.decoder_layers, self.num_attention_heads, self.intermediate_size, self.input_audio_length, self.max_output_seq_len, self.time_hz, self.sampling_rate, self.lora_rank, self.lora_alpha) <= 0: raise ValueError("Model dimensions and timing parameters must be positive.") if self.hidden_size % self.num_attention_heads: raise ValueError("hidden_size must be divisible by num_attention_heads.") if not 0 <= self.decoder_dropout < 1: raise ValueError("decoder_dropout must lie in [0, 1).") if self.sampling_rate != self.backbone_config["sampling_rate"]: raise ValueError("Processor and encoder sampling rates must match.")
SheetSage2Config.register_for_auto_class()1234567891011121314import numpy as np
DURATION_TEMPLATES = np.array( [ 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, ], dtype=np.int32,)duration_boundaries = (DURATION_TEMPLATES[:-1] + DURATION_TEMPLATES[1:]) / 2
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209"""Raw decoded events, key-aware chord LAB, MIDI and validated ABC."""from pathlib import Pathimport jsonfrom fractions import Fraction
import numpy as npimport pretty_midi
from .notation_sheetsage2 import generate_abc_from_datafrom .io_sheetsage2 import atomic_write_textfrom .generation_sheetsage2 import field_textfrom .chord_spelling_sheetsage2 import correct_chord_rows, normalize_key_namefrom .midi_sheetsage2 import build_playback, midi_bytes
def rows_text(rows): return "".join("\t".join(str(x) for x in row) + "\n" for row in rows)
def write_rows(path, rows): atomic_write_text(path, rows_text(rows))
def interval_rows(events, field, duration): rows = [[e["time"], 0, e["values"][field]] for e in events if field in e["values"]] for i, row in enumerate(rows): row[1] = rows[i + 1][0] if i + 1 < len(rows) else duration return [r for r in rows if r[1] > r[0]]
def rhythm_rows(events): rows, meter = [], None for event in events: rhythm = event["values"].get("rhythm", {}) meter = rhythm.get("meter", meter) eighth = rhythm.get("eighth_position") if eighth is not None and meter is not None: # The model stores eighth-note position, not denominator-beat index. position = Fraction(int(eighth) * int(meter[1]), 8) if position.denominator != 1: raise ValueError(f"Eighth position {eighth} is off the {meter[0]}/{meter[1]} beat grid") if not 0 <= position < meter[0]: raise ValueError(f"Eighth position {eighth} is outside meter {meter}") rows.append([float(event["time"]), int(position) + 1, int(meter[0]), int(meter[1])]) return rows
def _midi(notes, paper=False): midi = pretty_midi.PrettyMIDI(resolution=220 if paper else 960) names = ((0, "vocal_melody"), (1, "instrumental_melody")) if paper else ((0, "Vocal"), (1, "Ins")) for track, name in names: instrument = pretty_midi.Instrument(program=0, name=name) for start, end, pitch, source in notes: if track == source and end > start: instrument.notes.append(pretty_midi.Note(100, pitch, start, end)) midi.instruments.append(instrument) return midi
def notation_notes(notes): """A monophonic notation view, retaining the exact raw prediction separately.""" result, diagnostics = [], [] for track in (0, 1): ordered = sorted((list(n) for n in notes if n[3] == track), key=lambda n: (n[0], n[2], n[1])) for i, note in enumerate(ordered): if i + 1 < len(ordered) and note[1] > ordered[i + 1][0] + 1e-6: note[1] = ordered[i + 1][0] diagnostics.append(f"notation only: clipped track {track} note at {note[0]:.3f} to next onset") if note[1] > note[0] + 1e-6: result.append(note) return sorted(result), diagnostics
def export_result(decoded, tokenizer, output_dir=None, duration=None, paper=False, *, melody_only=False): """Build ABC, MIDI and LAB in memory, optionally writing the same bytes.
Statistics retain their file-interface names. ``payload`` contains the in-memory ABC text, MIDI bytes, decoded event list, LAB texts and playback. melody_only removes chords from notation and playback without changing decoded events or the key-corrected LAB annotations. """ if not isinstance(melody_only, bool): raise ValueError("melody_only must be True or False") if duration is None: raise TypeError("duration is required") texts, midis, notation_midis, labs = {}, {}, {}, {}
def keep_rows(name, rows): text = rows_text(rows) texts[name] = text if name.endswith(".lab"): labs[name[:-4]] = text
events = decoded["events"] notes = [] for event in events: start = float(event["time"]) for note in event["values"].get("melody", ()): end = max(start + 0.04, float(note["end_time"])) if paper else min(duration, float(note["end_time"])) if end > start: notes.append([start, end, int(note["pitch"]), int(note["track"])]) if not paper: notes.sort() texts["events.json"] = json.dumps(decoded, indent=2) keep_rows("events.tsv", [["time", "global_subbeat", "fields"]] + [[e["time"], e["global_subbeat"], field_text(e, tokenizer)] for e in events]) midis["melody"] = midi_bytes(_midi(notes, paper=paper)) lab_notes = [[f"{a:.6f}", f"{b:.6f}", p, t] for a, b, p, t in notes] if paper else notes keep_rows("melody_full.lab", lab_notes) for track, name in ((0, "vocal"), (1, "instrumental")): selected = [n for n in notes if n[3] == track] keep_rows(f"melody_{name}.lab", [n[:3] for n in lab_notes if n[3] == track]) midis[f"melody_{name}"] = midi_bytes(_midi(selected, paper=paper)) intervals = {} for field in ("chord", "key", "structure"): rows = interval_rows(events, field, duration) if paper: rows = [[float(e["time"]), None, e["values"][field]] for e in events if field in e["values"]] for i, row in enumerate(rows): row[1] = max(row[0], rows[i + 1][0]) if i + 1 < len(rows) else float(duration) intervals[field] = rows intervals["key"] = [[start, end, normalize_key_name(key)] for start, end, key in intervals["key"]] intervals["chord"] = correct_chord_rows(intervals["chord"], intervals["key"]) for field, rows in intervals.items(): keep_rows(f"{field}.lab", rows) if paper: rows = [] for event in events: rhythm, stamp = event["values"].get("rhythm"), event["values"].get("timestamp") if rhythm is None and stamp is None: continue meter = rhythm.get("meter") if isinstance(rhythm, dict) else None eighth = rhythm.get("eighth_position") if isinstance(rhythm, dict) else None rows.append([f"{event['time']:.6f}", "" if stamp is None else f"{float(stamp):.6f}", "" if eighth is None else int(eighth), "" if meter is None else f"{meter[0]}/{meter[1]}"]) keep_rows("beat_meter.lab", rows) raw_rhythm = [[e["time"], json.dumps(e["values"].get("rhythm", {}))] for e in events if "rhythm" in e["values"] or "timestamp" in e["values"]] keep_rows("rhythm_events.lab", raw_rhythm) diagnostics, abc_error, score, text = [], None, None, None try: beats = rhythm_rows(events) keep_rows("beat.lab", beats) keep_rows("downbeat.lab", [[r[0]] for r in beats if r[1] == 1]) if len(beats) < 2: raise ValueError("At least two decoded beats are required for ABC") # canonical notation's last beat is a boundary, so append it explicitly. Continue the # final tempo only as far as the audio/last note and let it pad the bar. abc_beats = [list(b) for b in beats] period = float(np.median(np.diff([b[0] for b in beats[-9:]]))) if period <= 0: raise ValueError("Decoded beats must increase in time") end = max(duration, max((n[1] for n in notes), default=0)) while abc_beats[-1][0] < end - 1e-6: prev = abc_beats[-1] abc_beats.append([prev[0] + period, prev[1] % prev[2] + 1, prev[2], prev[3]]) keep_rows("notation/song_beats.txt", abc_beats) notation_intervals = {} for field, suffix in (("chord", "chords"), ("key", "keys"), ("structure", "structures")): rows = interval_rows(events, field, duration) if field == "chord": rows = correct_chord_rows(rows, interval_rows(events, "key", duration)) elif field == "key": rows = [[start, end, normalize_key_name(key)] for start, end, key in rows] # Clip to the actual beat domain: events beyond it have no ABC bin. rows = [[max(abc_beats[0][0], a), min(abc_beats[-1][0], b), v] for a, b, v in rows if b > abc_beats[0][0] and a < abc_beats[-1][0]] notation_intervals[field] = rows keep_rows(f"notation/song_{suffix}.txt", rows) if not interval_rows(events, "key", duration): raise ValueError("No key was decoded; cannot construct a keyed ABC score") clean, adjustments = notation_notes(notes) diagnostics.extend(adjustments) notation_midis["notation/song_melody.mid"] = midi_bytes(_midi(clean)) text, score = generate_abc_from_data( notation_midis["notation/song_melody.mid"], abc_beats, notation_intervals["chord"], notation_intervals["key"], notation_intervals["structure"], melody_only=melody_only, ) diagnostics.extend(score.diagnostics) texts["score.abc"] = text abc_measures = len(score.measures) except (ValueError, FileNotFoundError) as exc: abc_error = str(exc) abc_measures = 0 playback, playback_midis = build_playback( midis["melody"], [] if melody_only else intervals["chord"], score, duration) midis.update(playback_midis) texts["playback.json"] = json.dumps(playback, indent=2) diagnostics.extend(playback["warnings"]) if output_dir is not None: output_dir = Path(output_dir) output_dir.mkdir(parents=True, exist_ok=True) for name, content in texts.items(): atomic_write_text(output_dir / name, content) for name, content in {**{f"{name}.mid": content for name, content in midis.items()}, **notation_midis}.items(): path = output_dir / name path.parent.mkdir(parents=True, exist_ok=True) path.write_bytes(content) if abc_error is not None: (output_dir / "score.abc").unlink(missing_ok=True) else: (output_dir / "score.browser.abc").unlink(missing_ok=True) payload = dict(abc=text, midi=midis["transcription"], midis=midis, events=events, labs=labs, playback=playback) return dict(melody_notes=len(notes), vocal_notes=sum(n[3] == 0 for n in notes), instrumental_notes=sum(n[3] == 1 for n in notes), events=len(events), abc_measures=abc_measures, abc_error=abc_error, diagnostics=diagnostics, payload=payload)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634"""Prompt grammar, cached generation and overlap context from the evaluated model."""import copyfrom contextlib import nullcontextfrom pathlib import Pathimport numpy as npimport torch
FULL_TASK_PROMPTS = ("timestamp", "downbeat_meter", "structure", "key", "chord_full", "melody_full")FIELD_TO_INDEX = {"timestamp": 0, "rhythm": 1, "structure": 2, "key": 3, "chord": 4, "melody": 5}
class PromptGrammarState: def __init__(self, tokenizer): self.tokenizer = tokenizer self.generated_events = 0 self.in_shift = True self.shift_run = 0 self.payload_count = 0 self.last_field_index = -1 self.incomplete = None
def _allow_field_starts(self, allowed): tokenizer = self.tokenizer if self.last_field_index < FIELD_TO_INDEX["timestamp"]: allowed[tokenizer.time_token_start : tokenizer.time_token_end] = True if self.last_field_index < FIELD_TO_INDEX["rhythm"]: allowed[tokenizer.meter_token_start : tokenizer.meter_token_end] = True allowed[ tokenizer.eighth_position_token_start : tokenizer.eighth_position_token_end ] = True if self.last_field_index < FIELD_TO_INDEX["structure"]: allowed[ tokenizer.structure_token_start : tokenizer.structure_token_end ] = True if self.last_field_index < FIELD_TO_INDEX["key"]: allowed[tokenizer.key_token_start : tokenizer.key_token_end] = True if self.last_field_index < FIELD_TO_INDEX["chord"]: allowed[ tokenizer.full_chord_token_start : tokenizer.full_chord_token_end ] = True if self.last_field_index <= FIELD_TO_INDEX["melody"]: allowed[tokenizer.pitch_token_start : tokenizer.pitch_token_end] = True
def allowed(self, device): tokenizer = self.tokenizer allowed = torch.zeros(tokenizer.n_tokens, dtype=torch.bool, device=device) can_end = self.payload_count > 0
if can_end: allowed[tokenizer.eos_token] = True if self.payload_count > 0 or self.in_shift: if self.shift_run < 4: allowed[ tokenizer.subbeat_shift_token_start : tokenizer.subbeat_shift_token_end ] = True
if self.incomplete == "rhythm_after_meter": allowed[ tokenizer.eighth_position_token_start : tokenizer.eighth_position_token_end ] = True return allowed
if self.incomplete == "melody_after_pitch": allowed[tokenizer.duration_token_start : tokenizer.duration_token_end] = True allowed[tokenizer.pitch_token_start : tokenizer.pitch_token_end] = True return allowed
self._allow_field_starts(allowed) return allowed
def update(self, token): tokenizer = self.tokenizer token = int(token) token_type = tokenizer.token_type(token) if token == tokenizer.eos_token: return True if token_type == "subbeat_shift": if not self.in_shift and self.payload_count > 0: self.generated_events += 1 self.payload_count = 0 self.last_field_index = -1 self.incomplete = None self.in_shift = True self.shift_run += 1 return False
self.in_shift = False self.shift_run = 0 self.payload_count += 1 if token_type == "time": self.last_field_index = FIELD_TO_INDEX["timestamp"] self.incomplete = None elif token_type == "meter": self.last_field_index = FIELD_TO_INDEX["rhythm"] self.incomplete = "rhythm_after_meter" elif token_type == "eighth_position": self.last_field_index = FIELD_TO_INDEX["rhythm"] self.incomplete = None elif token_type == "structure": self.last_field_index = FIELD_TO_INDEX["structure"] self.incomplete = None elif token_type == "key": self.last_field_index = FIELD_TO_INDEX["key"] self.incomplete = None elif token_type == "chord_full": self.last_field_index = FIELD_TO_INDEX["chord"] self.incomplete = None elif token_type == "pitch": self.last_field_index = FIELD_TO_INDEX["melody"] self.incomplete = "melody_after_pitch" elif token_type == "duration": self.last_field_index = FIELD_TO_INDEX["melody"] self.incomplete = None else: raise RuntimeError(f"Unexpected prompt token type {token_type!r}") return False
def inference_autocast(device, dtype=torch.bfloat16): if device.type != "cuda" or dtype is None: return nullcontext() return torch.autocast(device_type="cuda", dtype=dtype)
def select_cache_batch(cache, indices, batch_size): if cache is None: return None batch_select = getattr(cache, "batch_select_indices", None) if callable(batch_select): batch_select(indices) return cache if torch.is_tensor(cache): if cache.ndim > 0 and cache.shape[0] == batch_size: return cache.index_select(0, indices) return cache if isinstance(cache, tuple): return tuple(select_cache_batch(item, indices, batch_size) for item in cache) if isinstance(cache, list): return [select_cache_batch(item, indices, batch_size) for item in cache] if isinstance(cache, dict): return { key: select_cache_batch(value, indices, batch_size) for key, value in cache.items() } return cache
@torch.inference_mode()def constrained_prompt_generate_batch( model, audio, prompts, max_sequence_length, prefix_tokens=None, autocast_dtype=torch.bfloat16, stop_time_seconds=None, progress_callback=None, memory=None, step_callback=None,): tokenizer = model.tokenizer prefix = list(prefix_tokens) if prefix_tokens is not None else tokenizer.prompt_prefix(prompts) if not prefix or prefix[0] != tokenizer.sos_token: raise ValueError("generation prefix must begin with <|sos|>") if prefix[-1] == tokenizer.eos_token: prefix = prefix[:-1] if audio.ndim != 2 or audio.shape[0] < 1: raise ValueError(f"audio must have shape [batch, samples], got {tuple(audio.shape)}") states = [PromptGrammarState(tokenizer) for _ in range(audio.shape[0])] stop_times = [ None if stop_time_seconds is None else float(stop_time_seconds) for _ in states ] out_index = prefix.index(tokenizer.out_token) for state in states: for token in prefix[out_index + 1 :]: state.update(token) output_tokens = [list(prefix) for _ in states] active_sample_ids = list(range(audio.shape[0])) decoder_input = torch.tensor( [prefix] * audio.shape[0], dtype=torch.long, device=audio.device, ) past_key_values = None if memory is None: with inference_autocast(audio.device, autocast_dtype): memory = model.encode(audio) current_length = len(prefix) while active_sample_ids and current_length < int(max_sequence_length): with inference_autocast(audio.device, autocast_dtype): logits, past_key_values = model.decode( memory, decoder_input, use_cache=True, past_key_values=past_key_values, ) next_logits = logits[:, -1].float() allowed = torch.stack( [state.allowed(next_logits.device) for state in states], dim=0, ) masked_logits = next_logits.masked_fill(~allowed, float("-inf")) next_tokens = masked_logits.argmax(dim=-1) if step_callback is not None: step_callback(current_length, active_sample_ids, next_logits, masked_logits) next_token_values = next_tokens.tolist() keep_positions = [] for position, (sample_id, state, stop_time, token) in enumerate( zip(active_sample_ids, states, stop_times, next_token_values) ): output_tokens[sample_id].append(int(token)) finished = state.update(token) if ( not finished and stop_time is not None and tokenizer.time_token_start <= int(token) < tokenizer.time_token_end and tokenizer.token_to_time_id(token) / tokenizer.time_hz >= stop_time ): output_tokens[sample_id].append(tokenizer.eos_token) finished = True if not finished: keep_positions.append(position) current_length += 1 if progress_callback is not None and current_length % 64 == 0: progress_callback(current_length) if not keep_positions: break
old_batch_size = len(active_sample_ids) decoder_input = next_tokens[:, None] if len(keep_positions) == old_batch_size: continue
keep = torch.tensor(keep_positions, dtype=torch.long, device=audio.device) active_sample_ids = [active_sample_ids[position] for position in keep_positions] states = [states[position] for position in keep_positions] stop_times = [stop_times[position] for position in keep_positions] memory = memory.index_select(0, keep) past_key_values = select_cache_batch(past_key_values, keep, old_batch_size) decoder_input = decoder_input.index_select(0, keep)
for tokens in output_tokens: if tokens[-1] != tokenizer.eos_token: tokens.append(tokenizer.eos_token) return [torch.tensor(tokens, dtype=torch.long) for tokens in output_tokens]
@torch.inference_mode()def constrained_prompt_generate( model, audio, prompts, max_sequence_length, prefix_tokens=None, autocast_dtype=torch.bfloat16, stop_time_seconds=None, progress_callback=None, memory=None, step_callback=None,): if audio.shape[0] != 1: raise ValueError( "constrained_prompt_generate expects batch size 1; " "use constrained_prompt_generate_batch for batched inference" ) return constrained_prompt_generate_batch( model, audio, prompts, max_sequence_length, prefix_tokens=prefix_tokens, autocast_dtype=autocast_dtype, stop_time_seconds=stop_time_seconds, progress_callback=progress_callback, memory=memory, step_callback=step_callback, )[0]
def decode_generated_tokens(tokenizer, tokens, song_id, window_index=None): try: return tokenizer.decode_sequence(tokens, strict=True), None except ValueError as exc: recoverable_errors = ( "empty event at subbeat", "belongs to inactive output field", ) if not any(message in str(exc) for message in recoverable_errors): raise decoded = tokenizer.decode_sequence(tokens, strict=False) warning = { "song_id": song_id, "warning": "strict decode failed; recovered in non-strict decode", "error": str(exc), } if window_index is not None: warning["window_index"] = int(window_index) return decoded, warning
def event_time_map(decoded, target_seconds): anchors = [] for event in decoded["events"]: value = event["values"].get("timestamp") if value is not None: anchors.append((int(event["subbeat"]), float(value))) if not anchors: return lambda step: min(float(target_seconds), max(0.0, float(step) * 0.125)) anchors = sorted(dict(anchors).items()) steps = np.asarray([item[0] for item in anchors], dtype=np.float64) times = np.asarray([item[1] for item in anchors], dtype=np.float64) if len(anchors) >= 2: step_seconds = float(np.median(np.diff(times) / np.maximum(np.diff(steps), 1))) if not np.isfinite(step_seconds) or step_seconds <= 0: step_seconds = 0.125 else: step_seconds = 0.125
def lookup(step): step = float(step) if step <= steps[0]: return float(np.clip(times[0] + (step - steps[0]) * step_seconds, 0, target_seconds)) if step >= steps[-1]: return float(np.clip(times[-1] + (step - steps[-1]) * step_seconds, 0, target_seconds)) return float(np.interp(step, steps, times))
return lookup
def field_text(event, tokenizer): parts = [] for field in tokenizer.event_field_order: value = event["values"].get(field) if value is None: continue if field == "melody": note_parts = [] for note in value: duration = note["duration_bin"] note_parts.append( f"pitch={note['pitch']}:track={note['track']}:dur_bin={duration}:dur_steps={note['duration_steps']}" ) parts.append("melody=[" + ",".join(note_parts) + "]") elif isinstance(value, dict): parts.append(field + "=" + ",".join(f"{k}:{v}" for k, v in value.items())) else: parts.append(f"{field}={value}") return "; ".join(parts)
def event_start_time(event, time_lookup): if "time" in event: return float(event["time"]) return float(time_lookup(event["subbeat"]))
def write_events_tsv(decoded, tokenizer, time_lookup, path): with Path(path).open("w", encoding="utf-8") as f: f.write("event_index\tsubbeat\ttime\tfields\ttokens\n") for index, event in enumerate(decoded["events"]): token_text = " ".join( tokenizer.describe(token) for field in tokenizer.event_field_order for token in event["tokens_by_field"].get(field, ()) ) f.write( f"{index}\t{event['subbeat']}\t{event_start_time(event, time_lookup):.6f}\t" f"{field_text(event, tokenizer)}\t{token_text}\n" )
def clone_decoded_event(event): return { "subbeat": int(event["subbeat"]), "tokens_by_field": { field: [int(token) for token in tokens] for field, tokens in event["tokens_by_field"].items() }, "values": copy.deepcopy(event["values"]), }
def refresh_event_values(event, tokenizer, prompts): event["values"] = { field: tokenizer._decode_field(field, tokens, prompts) for field, tokens in event["tokens_by_field"].items() if tokens }
def set_event_local_timestamp(event, tokenizer, local_time): time_id = int(round(float(local_time) * tokenizer.time_hz)) time_id = max(0, min(time_id, tokenizer.n_time_tokens - 1)) event["tokens_by_field"]["timestamp"] = [tokenizer.time_id_to_token(time_id)]
def active_context_before(events, tokenizer, time_abs): state = {} for event in events: event_time = event.get("time") if event_time is None or float(event_time) > float(time_abs) + 1e-6: continue for field in ("structure", "key", "chord"): tokens = event["tokens_by_field"].get(field) if tokens: state[field] = [int(token) for token in tokens] rhythm_tokens = event["tokens_by_field"].get("rhythm", ()) meter_tokens = [ int(token) for token in rhythm_tokens if tokenizer.token_type(token) == "meter" ] if meter_tokens: state["meter"] = meter_tokens[:1] return state
def apply_prefix_context(event, context, tokenizer, prompts): for field in ("structure", "key", "chord"): if field not in event["tokens_by_field"] and field in context: event["tokens_by_field"][field] = list(context[field])
rhythm_tokens = list(event["tokens_by_field"].get("rhythm", ())) has_meter = any(tokenizer.token_type(token) == "meter" for token in rhythm_tokens) has_eighth = any( tokenizer.token_type(token) == "eighth_position" for token in rhythm_tokens ) if has_eighth and not has_meter and "meter" in context: event["tokens_by_field"]["rhythm"] = list(context["meter"]) + rhythm_tokens
refresh_event_values(event, tokenizer, prompts)
def build_overlap_prefix_tokens( stitched_events, tokenizer, prompts, window_start, prefix_end,): eps = 1e-4 source_events = [ event for event in stitched_events if float(window_start) - eps <= float(event.get("time", -1.0)) < float(prefix_end) - eps ] source_events.sort( key=lambda event: ( int( event.get( "global_subbeat", event.get("source_subbeat", event["subbeat"]), ) ), float(event.get("time", 0.0)), ) ) first_beat_index = next( ( index for index, event in enumerate(source_events) if "timestamp" in event["values"] or "rhythm" in event["values"] ), None, ) if first_beat_index is None: return None, None, None
source_events = source_events[first_beat_index:] base_subbeat = int( source_events[0].get( "global_subbeat", source_events[0].get("source_subbeat", source_events[0]["subbeat"]), ) ) context = active_context_before( stitched_events, tokenizer, source_events[0]["time"], ) prefix_events = [] for source in source_events: event = clone_decoded_event(source) source_subbeat = int( source.get( "global_subbeat", source.get("source_subbeat", source["subbeat"]), ) ) event["subbeat"] = max(0, source_subbeat - base_subbeat) if "timestamp" in event["tokens_by_field"]: set_event_local_timestamp( event, tokenizer, float(source["time"]) - float(window_start), ) refresh_event_values(event, tokenizer, prompts) prefix_events.append(event)
apply_prefix_context(prefix_events[0], context, tokenizer, prompts) prefix_decoded = { "schema_version": tokenizer.schema_version, "prompts": prompts, "events": prefix_events, "has_eos": False, } return ( prefix_decoded, tokenizer.encode_decoded_sequence(prefix_decoded), base_subbeat, )
def stitched_window_events( decoded, time_lookup, window_start, accept_start, accept_end, song_duration, window_index, global_subbeat_base=0,): accepted = [] eps = 1e-4 for event in decoded["events"]: local_time = float(time_lookup(event["subbeat"])) abs_time = float(window_start) + local_time if abs_time < float(accept_start) - eps: continue if abs_time >= float(accept_end) - eps or abs_time >= float(song_duration) - eps: continue
output = clone_decoded_event(event) output["time"] = float(np.clip(abs_time, 0.0, song_duration)) output["window_index"] = int(window_index) output["window_start"] = float(window_start) output["source_subbeat"] = int(event["subbeat"]) output["global_subbeat"] = int(global_subbeat_base) + int(event["subbeat"]) if "timestamp" in output["values"]: output["values"]["timestamp"] = output["time"]
notes = output["values"].get("melody") if notes is not None: fixed_notes = [] for note in notes: fixed_note = copy.deepcopy(note) duration_steps = int(fixed_note["duration_steps"]) local_end = float(time_lookup(int(event["subbeat"]) + duration_steps)) end_time = float(window_start) + local_end end_time = min( float(song_duration), max(output["time"] + 0.04, end_time), ) fixed_note["end_time"] = end_time fixed_notes.append(fixed_note) output["values"]["melody"] = fixed_notes accepted.append(output) return accepted
def write_window_tokens(path, windows, tokenizer): with Path(path).open("w", encoding="utf-8") as f: for window in windows: f.write( f"# window_index={window['window_index']} " f"start={window['start']:.6f} end={window['end']:.6f} " f"prefix_end={window['prefix_end']:.6f} " f"accept=[{window['accept_start']:.6f},{window['accept_end']:.6f}) " f"generation_stop={window['generation_stop']} " f"prefix_tokens={window['prefix_tokens']} " f"tokens={int(window['tokens'].numel())}\n" ) for index, token in enumerate(window["tokens"].tolist()): f.write(f"{index}\t{token}\t{tokenizer.describe(token)}\n") f.write("\n")
@torch.inference_mode()def generate(model, input_values, prompts=None, *, attention_mask=None, max_length=None, max_new_tokens=None, prefix_tokens=None, autocast_dtype=torch.bfloat16, stop_time_seconds=None, return_dict_in_generate=False, output_logits=False, output_scores=False, progress_callback=None): """Generate symbolic token sequences with the model's event grammar.
Inputs are 24 kHz waveforms [batch, samples]. Scores/logits are per generated step, after the prompt prefix, with completed batch items filled by NaNs. """ from transformers.utils import ModelOutput if input_values.ndim == 1: input_values = input_values.unsqueeze(0) if attention_mask is not None and attention_mask.ndim == 1: attention_mask = attention_mask.unsqueeze(0) input_values = input_values.to(next(model.parameters()).device) prompts = model.tokenizer.normalize_prompts(prompts or FULL_TASK_PROMPTS) prefix = list(prefix_tokens) if prefix_tokens is not None else model.tokenizer.prompt_prefix(prompts) prefix_length = len(prefix) - (1 if prefix and prefix[-1] == model.tokenizer.eos_token else 0) if max_new_tokens is not None: if max_length is not None: raise ValueError("Specify max_new_tokens or max_length, not both.") if not isinstance(max_new_tokens, int) or isinstance(max_new_tokens, bool) or max_new_tokens < 1: raise ValueError("max_new_tokens must be a positive integer.") max_length = prefix_length + max_new_tokens limit = model.max_output_seq_len if max_length is None else max_length if not isinstance(limit, int) or isinstance(limit, bool) or not prefix_length < limit <= model.max_output_seq_len: raise ValueError("The token limit must exceed the prefix length and fit the decoder context.") memory = None if attention_mask is not None: with inference_autocast(input_values.device, autocast_dtype): memory = model.get_audio_features(input_values, attention_mask=attention_mask).encoder_last_hidden_state raw, scores, positions = [], [], [] batch_size = input_values.shape[0] def capture(position, ids, logits, masked): positions.append(position) for enabled, values, output in ((output_logits, logits, raw), (output_scores, masked, scores)): if enabled: row = torch.full((batch_size, values.shape[-1]), float('nan'), dtype=torch.float32) row[ids] = values.detach().cpu() output.append(row) tokens = constrained_prompt_generate_batch( model, input_values, prompts, limit, prefix_tokens=prefix_tokens, autocast_dtype=autocast_dtype, stop_time_seconds=stop_time_seconds, progress_callback=progress_callback, step_callback=capture if output_logits or output_scores else None, memory=memory, ) sequences = torch.nn.utils.rnn.pad_sequence(tokens, batch_first=True, padding_value=model.tokenizer.pad_token) if return_dict_in_generate or output_logits or output_scores: return ModelOutput(sequences=sequences, logits=tuple(raw) if output_logits else None, scores=tuple(scores) if output_scores else None, token_positions=torch.tensor(positions, dtype=torch.long)) return sequences123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778"""Transcribe a music recording with SheetSage2."""import argparsefrom pathlib import Pathimport sys
SCRIPT_DIR = Path(__file__).absolute().parentsys.path.insert(0, str(SCRIPT_DIR))
def main(): parser = argparse.ArgumentParser(description="SheetSage2: music audio to ABC, MIDI, annotations and features") parser.add_argument("audio", type=Path) parser.add_argument("--output", type=Path, default=Path("output")) local = SCRIPT_DIR parser.add_argument("--model", default=str(local) if (local / "config.json").exists() else "m-a-p/SheetSage2") parser.add_argument("--revision", help="Model and code commit on Hugging Face") parser.add_argument("--device", default="auto") parser.add_argument("--dtype", choices=("bf16", "fp32"), default="bf16") parser.add_argument("--preset", choices=("default", "paper"), default="default") parser.add_argument("--max-seconds", type=float) parser.add_argument("--overlap", type=float) parser.add_argument("--lookahead", type=float) parser.add_argument("--prompts", nargs="+") parser.add_argument("--melody-only", action="store_true", help="Keep vocal and instrumental melodies; omit chords from ABC and playback") parser.add_argument("--export-logits", action="store_true") parser.add_argument("--export-scores", action="store_true") parser.add_argument("--export-embeddings", action="store_true") parser.add_argument("--all-layers", action="store_true", help="Also export all 24 MERT block features") parser.add_argument("--render-audio", action="store_true") parser.add_argument("--render-score", nargs="?", const="pdf", default=False, help="pdf,svg,png (default: pdf)") parser.add_argument("--render-parts", default="mix", help="mix,melody,vocal,instrumental,chords,all") parser.add_argument("--local-files-only", action="store_true") args = parser.parse_args() if args.render_audio or args.render_score: from rendering_sheetsage2 import validate_render_options try: validate_render_options(audio=args.render_audio, score=args.render_score, parts=args.render_parts) except ValueError as exc: parser.error(str(exc)) import torch from transformers import AutoModel torch.set_num_threads(min(4, torch.get_num_threads())) device = "cuda" if torch.cuda.is_available() else "cpu" if args.device == "auto" else args.device if args.device != "auto": device = args.device model = AutoModel.from_pretrained( args.model, revision=args.revision, code_revision=args.revision, local_files_only=args.local_files_only, trust_remote_code=True, ).eval().to(device) def progress(value): if value["stage"] == "encoding": print(f"Window {value['window']}/{value['windows']}", flush=True) options = dict(dtype=args.dtype, preset=args.preset, max_seconds=args.max_seconds, overlap_seconds=args.overlap, lookahead_seconds=args.lookahead, export_logits=args.export_logits, export_scores=args.export_scores, export_embeddings=args.export_embeddings, output_hidden_states=args.all_layers, render_audio=args.render_audio, render_score=args.render_score, render_parts=tuple(args.render_parts.split(",")), progress=progress) if args.prompts: options["prompts"] = args.prompts if args.melody_only: options["melody_only"] = True try: result = model.transcribe(args.audio, output_dir=args.output, **options) except (ValueError, RuntimeError, FileNotFoundError) as exc: parser.exit(1, f"SheetSage2: {exc}\n") if args.melody_only and (result.get("abc_error") or not result.get("abc")): reason = result.get("abc_error") or "no ABC score was produced" parser.exit(1, f"SheetSage2: melody-only ABC unavailable: {reason}. " f"Transcription outputs were saved to {args.output.resolve()}.\n") print(f"Saved transcription to {args.output.resolve()}") if result.get("abc_error"): print(f"ABC unavailable: {result['abc_error']}. MIDI and annotations were saved.")
if __name__ == "__main__": main()12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667import osimport statimport tempfilefrom contextlib import contextmanagerfrom pathlib import Path
def _target_path(path) -> Path: target = Path(path) target.parent.mkdir(parents=True, exist_ok=True) return target
def _flush_path(path: Path) -> None: with path.open("rb+") as handle: os.fsync(handle.fileno())
def _replacement_mode(target: Path) -> int: try: return stat.S_IMODE(target.stat().st_mode) except FileNotFoundError: mask = os.umask(0) os.umask(mask) return 0o666 & ~mask
@contextmanagerdef atomic_output_path(path): target = _target_path(path) mode = _replacement_mode(target) fd, tmp_name = tempfile.mkstemp( # Keep the temporary basename independent of the final basename. Some # annotation IDs are already close to NAME_MAX; repeating the target # name here made an otherwise valid final path fail with ENAMETOOLONG. prefix=".tmp_", suffix=".tmp", dir=str(target.parent), ) os.close(fd) tmp_path = Path(tmp_name) try: yield str(tmp_path) os.chmod(tmp_path, mode) _flush_path(tmp_path) os.replace(tmp_path, target) except Exception: try: tmp_path.unlink() except FileNotFoundError: pass raise
def atomic_write_text(path, text: str, encoding: str = "utf-8", newline: str = "\n") -> str: with atomic_output_path(path) as tmp_path: with open(tmp_path, "w", encoding=encoding, newline=newline) as handle: handle.write(text) handle.flush() os.fsync(handle.fileno()) return str(path)
def atomic_write_pretty_midi(midi, path) -> str: with atomic_output_path(path) as tmp_path: midi.write(tmp_path) return str(path)1234567891011121314151617181920212223242526272829
STRUCTURE_LABELS = ['silence', 'intro', 'outro', 'verse', 'chorus', 'bridge', 'pre-chorus', 'post-chorus', 'interlude', 'fade-out', 'loop', 'rap', 'preshot', 'irregular']
STRUCTURE_LABELS = ['silence', 'intro', 'outro', 'verse', 'chorus', 'bridge', 'pre-chorus', 'post-chorus', 'interlude', 'fade-out', 'loop', 'rap', 'preshot', 'irregular', 'instrumental', 'intro and verse', 'pre-chorus and chorus', 'verse and pre-chorus', 'solo', 'theme', 'development', 'variation', 'pre-outro']
MIREX_STRUCTURE_LABEL_REDUCTION = { 'silence': 'silence', 'intro': 'intro', 'outro': 'outro', 'verse': 'verse', 'chorus': 'chorus', 'bridge': 'bridge', 'pre-chorus': 'verse', 'post-chorus': 'verse', 'interlude': 'inst', 'inst': 'inst', 'fade-out': 'outro', 'loop': 'chorus', 'rap': 'verse', 'preshot': 'inst', 'irregular': 'verse',}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192"""Original-time MIDI playback and a separate score-to-audio measure map."""import jsonfrom io import BytesIOfrom pathlib import Path
import mir_eval.chordimport numpy as npimport pretty_midi
from .io_sheetsage2 import atomic_write_text
def chord_pitches(label): if label in {"N", "X", "?"}: return [] root, bitmap, bass = mir_eval.chord.encode(label, reduce_extended_chords=True) if root < 0: return [] # Keep inversion bass below the chord; no ABC chord-name reinterpretation. upper = [48 + root + int(interval) for interval in np.flatnonzero(bitmap > 0)] return sorted(set([36 + (root + bass) % 12] + upper))
def measure_map(score, duration): rows, position = [], 0.0 for measure in score.measures: length = measure.abc_numerator / measure.abc_denominator actual = measure.numerator / measure.denominator start = float(score.beats[measure.start_beat].time) end = float(score.beats[measure.end_beat].time) rows.append(dict(index=measure.index, start=start, end=min(end, duration), score_start=position, score_end=position + length, leading_rest=length - actual if measure.pad_before else 0.0, trailing_rest=length - actual if not measure.pad_before else 0.0)) position += length return rows
def midi_bytes(midi): """Serialize a PrettyMIDI object without touching the filesystem.""" stream = BytesIO() midi.write(stream) return stream.getvalue()
def build_playback(melody_midi, chord_rows, score, duration): """Return playback metadata and MIDI bytes, preserving MIDI tick rounding.""" if isinstance(melody_midi, pretty_midi.PrettyMIDI): melody_midi = midi_bytes(melody_midi) midi = pretty_midi.PrettyMIDI(BytesIO(melody_midi)) chord_track = pretty_midi.Instrument(0, name="Chords") warnings = [] for start, end, label in chord_rows: start, end = max(0.0, float(start)), min(duration, float(end)) try: pitches = chord_pitches(label) except mir_eval.chord.InvalidChordException as exc: warnings.append(f"Chord playback skipped {label}: {exc}") continue # Rearticulate long chord spans at downbeats, including repeated bars. downbeats = [b.time for b in score.beats if b.beat_id == 1] if score is not None else [] cuts = [start] + [time for time in downbeats if start < time < end] + [end] for a, b in zip(cuts, cuts[1:]): if b <= a: continue for pitch in pitches: chord_track.notes.append(pretty_midi.Note(48, pitch, a, b)) midi.instruments.append(chord_track) transcription = midi_bytes(midi) chords = pretty_midi.PrettyMIDI(resolution=midi.resolution) chords.instruments.append(chord_track) midis = {"transcription": transcription, "chords": midi_bytes(chords)} # Decode the serialized bytes, so playback follows the returned MIDI exactly. midi = pretty_midi.PrettyMIDI(BytesIO(transcription)) tracks = [dict(name=instrument.name, program=int(instrument.program), notes=[dict(pitch=int(n.pitch), start=float(n.start), end=float(n.end), velocity=int(n.velocity)) for n in instrument.notes]) for instrument in midi.instruments] data = dict(version=1, duration=duration, midi="transcription.mid", tracks=tracks, measures=measure_map(score, duration) if score is not None else [], warnings=warnings) return data, midis
def export_playback(directory, score, duration): """Write playback files for an existing directory of exported annotations.""" directory = Path(directory) chord_path = directory / "chord.lab" rows = [line.split(maxsplit=2) for line in chord_path.read_text(encoding="utf-8").splitlines()] if chord_path.exists() else [] data, midis = build_playback((directory / "melody.mid").read_bytes(), rows, score, duration) for name, content in midis.items(): (directory / f"{name}.mid").write_bytes(content) atomic_write_text(directory / "playback.json", json.dumps(data, indent=2)) return data123version https://git-lfs.github.com/spec/v1oid sha256:b235f68091a5f5b644000f2b5acb57d1e70432aca2b34ab1b9cf27236e1f4274size 228738564123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361"""Standalone MERT2 waveform-to-representation inference."""
from dataclasses import dataclassfrom typing import Optional, Tuple
import torchfrom torch import nnfrom torch.nn import functional as Ffrom torchaudio.transforms import AmplitudeToDB, MelScale, Spectrogramfrom transformers import PreTrainedModelfrom transformers.utils import ModelOutput
from .configuration_mert2 import MERT2Config
@dataclassclass MERT2ModelOutput(ModelOutput): """Frame representations and their validity mask.
``hidden_states`` contains one tensor per Conformer block, without an input embedding. ``feature_attention_mask`` is True at valid output frames. """
last_hidden_state: Optional[torch.FloatTensor] = None hidden_states: Optional[Tuple[torch.FloatTensor, ...]] = None feature_attention_mask: Optional[torch.BoolTensor] = None
class MERT2MelFrontend(nn.Module): """Power log-mel features with fixed, checkpoint-specific normalization."""
def __init__(self, config): super().__init__() # Filter construction requires real tensors even during meta loading. with torch.device("cpu"): self.register_buffer("mel_mean", torch.zeros(config.num_mel_bins, dtype=torch.float32)) self.register_buffer("mel_std", torch.ones(config.num_mel_bins, dtype=torch.float32)) self.spectrogram = Spectrogram( n_fft=config.n_fft, win_length=config.win_length, hop_length=config.hop_length, power=2.0, ).float() self.mel_scale = MelScale( n_mels=config.num_mel_bins, sample_rate=config.sampling_rate, n_stft=config.n_fft // 2 + 1, ).float() self.amplitude_to_db = AmplitudeToDB(stype="power", top_db=None)
def _apply(self, fn, recurse=True): # Preserve the original float32 values, including on model.half(). saved = [(module, name, value) for module in self.modules() for name, value in module._buffers.items() if value is not None] super()._apply(fn, recurse=recurse) for module, name, original in saved: current = module._buffers[name] if original.is_floating_point(): module._buffers[name] = ( current.float() if original.is_meta else original.to(device=current.device, dtype=torch.float32) ) return self
@torch.no_grad() def forward(self, waveform): with torch.autocast(device_type=waveform.device.type, enabled=False): spectrum = self.spectrogram(waveform.float()) mel = self.amplitude_to_db(self.mel_scale(spectrum)) mel = mel[..., :-1].transpose(-1, -2) return (mel - self.mel_mean) / self.mel_std.clamp_min(1e-5)
class Transpose(nn.Module): def forward(self, hidden_states): return hidden_states.transpose(1, 2)
class GlobalResponseNorm(nn.Module): def __init__(self, dim): super().__init__() self.weight = nn.Parameter(torch.zeros(1, 1, dim)) self.bias = nn.Parameter(torch.zeros(1, 1, dim))
def forward(self, hidden_states): magnitude = torch.norm(hidden_states, p=2, dim=1, keepdim=True) normalized = magnitude / (magnitude.mean(dim=-1, keepdim=True) + 1e-6) return self.weight * (hidden_states * normalized) + self.bias + hidden_states
class ConvNextLayer(nn.Module): def __init__(self, dim, eps): super().__init__() self.depthwise_block = nn.Sequential( Transpose(), nn.Conv1d(dim, dim, 7, padding=3, groups=dim), Transpose() ) self.pointwise_block = nn.Sequential( nn.LayerNorm(dim, eps=eps), nn.Linear(dim, 4 * dim), nn.GELU(), GlobalResponseNorm(4 * dim), nn.Linear(4 * dim, dim), )
def forward(self, hidden_states): return hidden_states + self.pointwise_block(self.depthwise_block(hidden_states))
class ConvNextBlock(nn.Module): def __init__(self, in_channels, out_channels, stride, depth, eps): super().__init__() self.resampling_layer = ( nn.Sequential( nn.LayerNorm(in_channels, eps=eps), Transpose(), nn.Conv1d(in_channels, out_channels, 2, stride=stride), Transpose(), ) if in_channels != out_channels or stride > 1 else nn.Identity() ) self.convnext_layers = nn.Sequential(*[ConvNextLayer(out_channels, eps) for _ in range(depth)])
def forward(self, hidden_states): return self.convnext_layers(self.resampling_layer(hidden_states))
class RotaryEmbedding(nn.Module): def __init__(self, config): super().__init__() self.head_dim = config.hidden_size // config.num_attention_heads self.base = config.rotary_embedding_base with torch.device("cpu"): inverse_frequency = 1.0 / ( self.base ** (torch.arange(0, self.head_dim, 2, dtype=torch.float32) / self.head_dim) ) self.register_buffer("inv_freq", inverse_frequency, persistent=False) self._sequence_length = 0 self._cache_device = None self._cos = None self._sin = None
def _apply(self, fn, recurse=True): original = self.inv_freq super()._apply(fn, recurse=recurse) self.inv_freq = original.to(device=self.inv_freq.device, dtype=torch.float32) return self
def forward(self, hidden_states): length = hidden_states.shape[1] if self._cos is None or self._cache_device != hidden_states.device or length > self._sequence_length: positions = torch.arange(length, device=hidden_states.device, dtype=self.inv_freq.dtype) frequencies = torch.einsum("i,j->ij", positions, self.inv_freq) angles = torch.cat((frequencies, frequencies), dim=-1) self._cos = angles.cos()[:, None, None, :] self._sin = angles.sin()[:, None, None, :] self._sequence_length = length self._cache_device = hidden_states.device return ( self._cos[:length].to(hidden_states.dtype).permute(1, 0, 2, 3), self._sin[:length].to(hidden_states.dtype).permute(1, 0, 2, 3), )
def rotate_half(value): first, second = value.chunk(2, dim=-1) return torch.cat((-second, first), dim=-1)
class SelfAttention(nn.Module): def __init__(self, config): super().__init__() self.config = config self.num_heads = config.num_attention_heads self.head_dim = config.hidden_size // self.num_heads self.query_proj = nn.Linear(config.hidden_size, config.hidden_size) self.key_proj = nn.Linear(config.hidden_size, config.hidden_size) self.value_proj = nn.Linear(config.hidden_size, config.hidden_size) self.out_proj = nn.Linear(config.hidden_size, config.hidden_size)
def forward(self, hidden_states, position_embeddings): batch, time, width = hidden_states.shape shape = (batch, time, self.num_heads, self.head_dim) query = self.query_proj(hidden_states).reshape(shape) key = self.key_proj(hidden_states).reshape(shape) value = self.value_proj(hidden_states).reshape(shape) cos, sin = position_embeddings query = query * cos + rotate_half(query) * sin key = key * cos + rotate_half(key) * sin if self.config._attn_implementation == "flash_attention_2": if query.device.type != "cuda" or query.dtype not in (torch.float16, torch.bfloat16): raise ValueError("flash_attention_2 requires CUDA and float16/bfloat16 activations; use autocast or load a reduced-precision model.") try: from flash_attn import flash_attn_func except ImportError as error: raise ImportError("Install flash-attn to use flash_attention_2, or select attn_implementation='sdpa'.") from error attended = flash_attn_func(query.contiguous(), key.contiguous(), value.contiguous(), dropout_p=0.0, causal=False) else: attended = F.scaled_dot_product_attention( query.transpose(1, 2), key.transpose(1, 2), value.transpose(1, 2), dropout_p=0.0, is_causal=False ).transpose(1, 2) return self.out_proj(attended.reshape(batch, time, width))
class FeedForward(nn.Module): def __init__(self, config): super().__init__() self.w_1 = nn.Linear(config.hidden_size, config.intermediate_size) self.w_2 = nn.Linear(config.intermediate_size, config.hidden_size)
def forward(self, hidden_states): return self.w_2(F.gelu(self.w_1(hidden_states)))
class ConvolutionModule(nn.Module): def __init__(self, config): super().__init__() width = config.hidden_size kernel = config.conv_depthwise_kernel_size self.layer_norm = nn.LayerNorm(width, eps=config.layer_norm_eps) self.conv_block = nn.Sequential( Transpose(), nn.Conv1d(width, 2 * width, 1, bias=False), nn.GLU(dim=1), nn.Conv1d(width, width, kernel, padding=(kernel - 1) // 2, groups=width, bias=False), nn.Sequential(Transpose(), nn.LayerNorm(width, eps=config.layer_norm_eps), Transpose()), nn.GELU(), nn.Conv1d(width, width, 1, bias=False), Transpose(), )
def forward(self, hidden_states): return self.conv_block(self.layer_norm(hidden_states))
class ConformerBlock(nn.Module): def __init__(self, config): super().__init__() width, eps = config.hidden_size, config.layer_norm_eps self.ffn1_layer_norm = nn.LayerNorm(width, eps=eps) self.ffn1 = FeedForward(config) self.attn_layer_norm = nn.LayerNorm(width, eps=eps) self.attn = SelfAttention(config) self.conv_module = ConvolutionModule(config) self.ffn2_layer_norm = nn.LayerNorm(width, eps=eps) self.ffn2 = FeedForward(config) self.final_layer_norm = nn.LayerNorm(width, eps=eps)
def forward(self, hidden_states, position_embeddings): hidden_states = hidden_states + 0.5 * self.ffn1(self.ffn1_layer_norm(hidden_states)) hidden_states = self.attn(self.attn_layer_norm(hidden_states), position_embeddings) + hidden_states hidden_states = self.conv_module(hidden_states) + hidden_states hidden_states = hidden_states + 0.5 * self.ffn2(self.ffn2_layer_norm(hidden_states)) return self.final_layer_norm(hidden_states)
class MERT2Model(PreTrainedModel): """Encode mono waveforms into 25 Hz MERT2 frame representations.
Inputs are floating-point mono waveforms sampled at ``config.sampling_rate``. Do not standardize their amplitude. An optional waveform attention mask must contain a prefix of ones followed by zeros. Without a mask, every input sample, including any caller-provided silence or padding, is processed. """
config_class = MERT2Config base_model_prefix = "" main_input_name = "input_values" _supports_sdpa = True _supports_flash_attn_2 = True _no_split_modules = ["ConvNextBlock", "ConformerBlock"]
def __init__(self, config): super().__init__(config) if config._attn_implementation not in {"sdpa", "flash_attention_2"}: raise ValueError("MERT2 supports attn_implementation='sdpa' or 'flash_attention_2'.") self.feature_extractor = MERT2MelFrontend(config) channels = [config.num_mel_bins] + config.subsampling_channels self.subsampling_module = nn.Sequential(*[ ConvNextBlock(channels[i], channels[i + 1], (1, 2, 2)[i], config.subsampling_depths[i], config.subsampling_layer_norm_eps) for i in range(3) ]) self.layers = nn.ModuleList([ConformerBlock(config) for _ in range(config.num_hidden_layers)]) self.embed_positions = RotaryEmbedding(config) self.post_init()
def _init_weights(self, module): if isinstance(module, (nn.Linear, nn.Conv1d)): nn.init.normal_(module.weight, mean=0.0, std=self.config.initializer_range) if module.bias is not None: nn.init.zeros_(module.bias) elif isinstance(module, nn.LayerNorm): nn.init.ones_(module.weight) nn.init.zeros_(module.bias)
def _get_feat_extract_output_lengths(self, input_lengths): return input_lengths // self.config.inputs_to_logits_ratio
def _encode(self, input_values, output_hidden_states): mel = self.feature_extractor(input_values) input_dtype = self.subsampling_module[0].convnext_layers[0].depthwise_block[1].weight.dtype hidden = self.subsampling_module(mel.to(dtype=input_dtype)) positions = self.embed_positions(hidden) states = [] if output_hidden_states else None for layer in self.layers: hidden = layer(hidden, positions) if states is not None: states.append(hidden) return hidden, tuple(states) if states is not None else None
def forward(self, input_values, attention_mask=None, output_hidden_states=None, return_dict=None): """Return final frames, optionally all block states, and a frame mask.
Different valid waveform lengths are encoded separately so convolution and global normalization never incorporate another sample's padding. Outputs are zero-padded to the longest valid feature sequence. """ output_hidden_states = self.config.output_hidden_states if output_hidden_states is None else output_hidden_states return_dict = self.config.use_return_dict if return_dict is None else return_dict if input_values.ndim != 2 or not input_values.is_floating_point() or input_values.shape[0] == 0: raise ValueError("input_values must be a nonempty floating-point tensor of shape [batch, samples].") if input_values.shape[1] < self.config.minimum_input_samples: raise ValueError(f"Each waveform must contain at least {self.config.minimum_input_samples} samples.") if not torch.isfinite(input_values).all(): raise ValueError("input_values must contain only finite samples.") batch, samples = input_values.shape if attention_mask is None: hidden, states = self._encode(input_values, output_hidden_states) feature_mask = torch.ones(hidden.shape[:2], dtype=torch.bool, device=hidden.device) else: if attention_mask.shape != input_values.shape: raise ValueError("attention_mask must have the same shape as input_values.") attention_mask = attention_mask.to(device=input_values.device) if not ((attention_mask == 0) | (attention_mask == 1)).all(): raise ValueError("attention_mask must contain only zeros and ones.") mask = attention_mask.bool() lengths = mask.sum(dim=1) expected = torch.arange(samples, device=input_values.device)[None, :] < lengths[:, None] if not torch.equal(mask, expected): raise ValueError("attention_mask must be right padded: valid samples followed by padding.") if (lengths < self.config.minimum_input_samples).any(): raise ValueError(f"Each waveform must contain at least {self.config.minimum_input_samples} valid samples.") feature_lengths = self._get_feat_extract_output_lengths(lengths) maximum = int(feature_lengths.max().item()) feature_mask = torch.arange(maximum, device=input_values.device)[None, :] < feature_lengths[:, None] hidden, state_values = None, None for length in torch.unique(lengths, sorted=True).tolist(): indices = torch.where(lengths == length)[0] group_hidden, group_states = self._encode(input_values.index_select(0, indices)[:, :length], output_hidden_states) padding = (0, 0, 0, maximum - group_hidden.shape[1]) if hidden is None: hidden = group_hidden.new_zeros(batch, maximum, self.config.hidden_size) if output_hidden_states: state_values = [torch.zeros_like(hidden) for _ in self.layers] hidden = hidden.index_copy(0, indices, F.pad(group_hidden, padding)) if state_values is not None: for i, value in enumerate(group_states): state_values[i] = state_values[i].index_copy(0, indices, F.pad(value, padding)) states = tuple(state_values) if state_values is not None else None output = MERT2ModelOutput(last_hidden_state=hidden, hidden_states=states, feature_attention_mask=feature_mask) return output if return_dict else output.to_tuple()
MERT2Model.register_for_auto_class("AutoModel")1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570"""Convert timed musical events into validated two-voice ABC notation."""
from __future__ import annotations
import mathimport osimport refrom collections import Counterfrom dataclasses import dataclass, replacefrom io import BytesIOfrom pathlib import Pathfrom typing import Iterable, Sequence
import numpy as npimport pretty_midi
from .io_sheetsage2 import atomic_write_text
SUBBEAT_DIVISION = 4VOICE_IDS = ("Vocal", "Ins")NO_CHORDS = frozenset({"N", "X", "?"})
class AbcRebuildError(ValueError): """Base class for deterministic reconstruction failures."""
class BeatGridError(AbcRebuildError): pass
class ChordSymbolError(AbcRebuildError): pass
class MelodyVoiceError(AbcRebuildError): pass
@dataclass(frozen=True)class BeatEvent: time: float beat_id: int declared_numerator: int denominator: int line_no: int
@dataclass(frozen=True)class Measure: index: int start_beat: int end_beat: int numerator: int denominator: int pickup: bool = False partial: bool = False inferred: bool = False notated_numerator: int | None = None notated_denominator: int | None = None pad_before: bool = False
@property def beat_count(self) -> int: return self.end_beat - self.start_beat
@property def start_t(self) -> int: return self.start_beat * SUBBEAT_DIVISION
@property def end_t(self) -> int: return self.end_beat * SUBBEAT_DIVISION
@property def abc_numerator(self) -> int: return self.notated_numerator or self.numerator
@property def abc_denominator(self) -> int: return self.notated_denominator or self.denominator
@dataclassclass RebuiltAbcScore: beats: list[BeatEvent] measures: list[Measure] subbeat_times: np.ndarray subbeat_quarters: np.ndarray subbeat_denominators: np.ndarray key_arr: np.ndarray chord_arr: np.ndarray structure_events: list[tuple[int, str]] voice_arrs: dict[str, np.ndarray] diagnostics: list[str] subbeat_div: int = SUBBEAT_DIVISION
@dataclassclass MeasureGroup: measures: list[Measure] structure_labels: list[str] meter_changed: bool key_changed: bool
_QUALITY_TO_ABC = { "maj": "", "min": "m", "dim": "dim", "aug": "aug", "7": "7", "maj7": "maj7", "min7": "m7", "dim7": "dim7", "hdim7": "m7b5", "sus4": "sus4", "sus2": "sus2", "maj6": "6", "min6": "m6", "sus4(b7)": "7sus4", # abc2midi and SymMusic both accept the parenthesized major seventh. # Common aliases such as mmaj7/mM7 trigger abc2midi diagnostics. "minmaj7": "m(maj7)",}
_NATURAL_PITCH_CLASS = { "C": 0, "D": 2, "E": 4, "F": 5, "G": 7, "A": 9, "B": 11,}_LETTERS = "CDEFGAB"_SHARP_PITCH_NAMES = ("C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B")_FLAT_PITCH_NAMES = ("C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B")_ROOT_RE = re.compile(r"^(?P<letter>[A-G])(?P<accidental>#{0,2}|b{0,2})$")_BASS_DEGREE_RE = re.compile(r"^(?P<accidental>#{0,2}|b{0,2})(?P<degree>[1-9]|1[0-3])$")
_KEY_SIGNATURE_ACCIDENTALS = { "C": 0, "G": 1, "D": 2, "A": 3, "E": 4, "B": 5, "F#": 6, "C#": 7, "F": -1, "Bb": -2, "Eb": -3, "Ab": -4, "Db": -5, "Gb": -6, "Cb": -7, "Am": 0, "Em": 1, "Bm": 2, "F#m": 3, "C#m": 4, "G#m": 5, "D#m": 6, "A#m": 7, "Dm": -1, "Gm": -2, "Cm": -3, "Fm": -4, "Bbm": -5, "Ebm": -6, "Abm": -7,}
# Keep the standard key-relative chromatic spelling. MIDI carries only# pitch, not note names, so a deterministic key-based table is preferable to# rewriting every chromatic pitch with a single sharp/flat. In remote sharp# and flat keys this deliberately permits musically useful double accidentals,# for example MIDI G as F## in G# minor._KEY_RELATIVE_PITCH_NAMES = { 7: ("B#", "C#", "C##", "D#", "D##", "E#", "F#", "F##", "G#", "G##", "A#", "B"), 6: ("B#", "C#", "C##", "D#", "E", "E#", "F#", "F##", "G#", "G##", "A#", "B"), 5: ("B#", "C#", "C##", "D#", "E", "E#", "F#", "F##", "G#", "A", "A#", "B"), 4: ("B#", "C#", "D", "D#", "E", "E#", "F#", "F##", "G#", "A", "A#", "B"), 3: ("B#", "C#", "D", "D#", "E", "E#", "F#", "G", "G#", "A", "A#", "B"), 2: ("C", "C#", "D", "D#", "E", "E#", "F#", "G", "G#", "A", "A#", "B"), 1: ("C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"), 0: ("C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "Bb", "B"), -1: ("C", "C#", "D", "Eb", "E", "F", "F#", "G", "G#", "A", "Bb", "B"), -2: ("C", "C#", "D", "Eb", "E", "F", "F#", "G", "Ab", "A", "Bb", "B"), -3: ("C", "Db", "D", "Eb", "E", "F", "F#", "G", "Ab", "A", "Bb", "B"), -4: ("C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B"), -5: ("C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "Cb"), -6: ("C", "Db", "D", "Eb", "Fb", "F", "Gb", "G", "Ab", "A", "Bb", "Cb"), -7: ("C", "Db", "D", "Eb", "Fb", "F", "Gb", "G", "Ab", "Bbb", "Bb", "Cb"),}
def _read_tsv(path: os.PathLike[str] | str, min_columns: int) -> list[tuple[int, list[str]]]: rows = [] with open(path, "r", encoding="utf-8-sig") as handle: for line_no, raw_line in enumerate(handle, 1): line = raw_line.rstrip("\r\n") if not line.strip(): continue columns = line.split("\t") if len(columns) < min_columns: raise AbcRebuildError( f"{path}:{line_no}: expected at least {min_columns} tab-separated columns" ) rows.append((line_no, columns)) return rows
def read_beats(path: os.PathLike[str] | str) -> list[BeatEvent]: return _parse_beats(_read_tsv(path, 3), path)
def _row_entries(rows, source): entries = [] for line_no, row in enumerate(rows, 1): if len(row) < 3: raise AbcRebuildError(f"{source}:{line_no}: expected at least 3 columns") entries.append((line_no, [str(value) for value in row])) return entries
def _parse_beats(entries, path): beats = [] for line_no, row in entries: meter_text = row[2] if len(row) >= 4: numerator_text, denominator_text = meter_text, row[3] elif "/" in meter_text: numerator_text, denominator_text = meter_text.split("/", 1) else: numerator_text, denominator_text = meter_text, "4" try: beat = BeatEvent( time=float(row[0]), beat_id=int(row[1]), declared_numerator=int(numerator_text), denominator=int(denominator_text), line_no=line_no, ) except ValueError as exc: raise BeatGridError(f"{path}:{line_no}: invalid beat row {row!r}") from exc if beat.beat_id < 1: raise BeatGridError(f"{path}:{line_no}: beat ID must be positive") if beat.declared_numerator < 1: raise BeatGridError(f"{path}:{line_no}: meter numerator must be positive") if beat.denominator < 1 or beat.denominator & (beat.denominator - 1): raise BeatGridError( f"{path}:{line_no}: meter denominator must be a positive power of two" ) if beats and beat.time <= beats[-1].time: raise BeatGridError(f"{path}:{line_no}: beat times must be strictly increasing") beats.append(beat) if len(beats) < 2: raise BeatGridError(f"{path}: at least two beat events are required") return beats
def read_chords(path: os.PathLike[str] | str) -> list[tuple[float, float, str]]: return _parse_chords(_read_tsv(path, 3), path)
def _parse_chords(entries, path): rows = [] previous_end = None for line_no, row in entries: start, end, chord = float(row[0]), float(row[1]), row[2].strip() if end <= start: raise ChordSymbolError(f"{path}:{line_no}: chord end must be after start") if previous_end is not None and start < previous_end - 1e-6: raise ChordSymbolError(f"{path}:{line_no}: overlapping chord intervals") chord_symbol_to_abc(chord) rows.append((start, end, chord)) previous_end = end return rows
def read_keys(path: os.PathLike[str] | str) -> list[tuple[float, float, str]]: return _parse_keys(_read_tsv(path, 3), path)
def _parse_keys(entries, path): rows = [] previous_end = None for line_no, row in entries: start, end, key = float(row[0]), float(row[1]), row[2].strip() if end <= start: raise AbcRebuildError(f"{path}:{line_no}: key end must be after start") if previous_end is not None and start < previous_end - 1e-6: raise AbcRebuildError(f"{path}:{line_no}: overlapping key intervals") normalized = key_symbol_to_abc(key) rows.append((start, end, normalized)) previous_end = end if not rows: raise AbcRebuildError(f"{path}: at least one key interval is required") return rows
def read_structures(path: os.PathLike[str] | str) -> list[tuple[float, float, str]]: return _parse_structures(_read_tsv(path, 3), path)
def _parse_structures(entries, path): rows = [] previous_end = None for line_no, row in entries: start, end, label = float(row[0]), float(row[1]), row[2].strip() if end <= start: raise AbcRebuildError(f"{path}:{line_no}: structure end must be after start") if previous_end is not None and start < previous_end - 1e-6: raise AbcRebuildError(f"{path}:{line_no}: overlapping structure intervals") rows.append((start, end, label)) previous_end = end return rows
def _mode_with_first_tiebreak(values: Sequence[int]) -> int: counts = Counter(values) maximum = max(counts.values()) return next(value for value in values if counts[value] == maximum)
def infer_measures( beats: Sequence[BeatEvent], *, meter_conflict: str = "infer",) -> tuple[list[Measure], list[str]]: """Infer self-consistent measures from actual downbeat boundaries."""
if meter_conflict not in {"infer", "reject"}: raise ValueError("meter_conflict must be 'infer' or 'reject'") downbeat_indices = [index for index, beat in enumerate(beats) if beat.beat_id == 1] if not downbeat_indices: raise BeatGridError("No downbeat (beat ID 1) exists in the beat lab") spans: list[tuple[int, int, bool, bool]] = [] if downbeat_indices[0] > 0: spans.append((0, downbeat_indices[0], True, False)) spans.extend( (start, end, False, False) for start, end in zip(downbeat_indices, downbeat_indices[1:]) ) if downbeat_indices[-1] < len(beats) - 1: # Exported beat labs use their last row as the score end boundary. If # that row is not a downbeat, the final bar is intentionally truncated. spans.append((downbeat_indices[-1], len(beats) - 1, False, True)) if not spans: raise BeatGridError("No positive-length measure exists between downbeats")
diagnostics = [] measures = [] for measure_index, (start, end, pickup, partial) in enumerate(spans): events = list(beats[start:end]) beat_count = len(events) if beat_count < 1: raise BeatGridError(f"Measure {measure_index}: empty downbeat span") ids = [event.beat_id for event in events] expected_ids = list(range(ids[0], ids[0] + beat_count)) if ids != expected_ids: line_numbers = [event.line_no for event in events] raise BeatGridError( f"Measure {measure_index} (beat rows {line_numbers[0]}-{line_numbers[-1]}): " f"non-consecutive beat IDs {ids!r}" ) if not pickup and ids[0] != 1: raise BeatGridError(f"Measure {measure_index}: full measure does not start at beat ID 1")
denominators = [event.denominator for event in events] denominator = _mode_with_first_tiebreak(denominators) declared_numerators = [event.declared_numerator for event in events] declared_numerator = _mode_with_first_tiebreak(declared_numerators) numerator_conflict = any(value != beat_count for value in declared_numerators) denominator_conflict = any(value != denominator for value in denominators) pad_final_partial = ( partial and len(set(declared_numerators)) == 1 and not denominator_conflict and declared_numerator >= beat_count ) inferred = pickup or partial or numerator_conflict or denominator_conflict unresolved_numerator_conflict = ( numerator_conflict and not pad_final_partial and not pickup ) if ( unresolved_numerator_conflict or denominator_conflict ) and meter_conflict == "reject": raise BeatGridError( f"Measure {measure_index}: {beat_count} actual beats conflict with declarations " f"{list(zip(declared_numerators, denominators))!r}" ) if pad_final_partial and declared_numerator > beat_count: diagnostics.append( f"measure {measure_index}: padded final {beat_count}/{denominator} span " f"to declared {declared_numerator}/{denominator} with trailing rest" ) elif numerator_conflict: diagnostics.append( f"measure {measure_index}: inferred {beat_count}/{denominator} from downbeat span; " f"declared numerators were {declared_numerators}" ) if denominator_conflict: diagnostics.append( f"measure {measure_index}: placed denominator {denominator} at the measure boundary; " f"row declarations were {denominators}" ) measures.append( Measure( index=measure_index, start_beat=start, end_beat=end, numerator=beat_count, denominator=denominator, pickup=pickup, partial=partial, inferred=inferred, notated_numerator=( declared_numerator if pad_final_partial else beat_count ), ) ) if len(measures) >= 2: first = measures[0] following = measures[1] first_duration = first.numerator / first.denominator following_duration = ( following.abc_numerator / following.abc_denominator ) if first_duration < following_duration: measures[0] = replace( first, inferred=True, notated_numerator=following.abc_numerator, notated_denominator=following.abc_denominator, pad_before=True, ) diagnostics.append( f"measure 0: padded leading {first.numerator}/{first.denominator} span " f"to {following.abc_numerator}/{following.abc_denominator} " f"with preceding rest" ) return measures, diagnostics
def _build_grid(beats: Sequence[BeatEvent], measures: Sequence[Measure]): interval_denominators = np.zeros(len(beats) - 1, dtype=np.int32) for measure in measures: interval_denominators[measure.start_beat:measure.end_beat] = measure.denominator if np.any(interval_denominators == 0): raise BeatGridError("Downbeat spans do not cover every beat interval")
subbeat_times = [] subbeat_denominators = [] quarter_positions = [0.0] current_quarter = 0.0 for index in range(len(beats) - 1): start = beats[index].time end = beats[index + 1].time denominator = int(interval_denominators[index]) times = np.linspace(start, end, SUBBEAT_DIVISION + 1)[:-1] subbeat_times.extend(float(value) for value in times) subbeat_denominators.extend([denominator] * SUBBEAT_DIVISION) quarter_step = 4.0 / denominator / SUBBEAT_DIVISION for _ in range(SUBBEAT_DIVISION): current_quarter += quarter_step quarter_positions.append(current_quarter) subbeat_times.append(beats[-1].time) subbeat_denominators.append(int(interval_denominators[-1])) return ( np.asarray(subbeat_times, dtype=np.float64), np.asarray(quarter_positions, dtype=np.float64), np.asarray(subbeat_denominators, dtype=np.int32), )
def _subbeat_boundaries(subbeat_times: np.ndarray) -> np.ndarray: return (subbeat_times[:-1] + subbeat_times[1:]) / 2
def _quantize_time(time: float, subbeat_times: np.ndarray) -> int: return int(np.searchsorted(_subbeat_boundaries(subbeat_times), float(time)))
def _fill_intervals(rows, subbeat_times, *, default, dtype): result = np.full(len(subbeat_times), default, dtype=dtype) for start, end, value in rows: start_t = _quantize_time(start, subbeat_times) end_t = _quantize_time(end, subbeat_times) start_t = max(0, min(start_t, len(result) - 1)) end_t = max(0, min(end_t, len(result) - 1)) if end_t <= start_t: raise AbcRebuildError( f"Interval {start:.6f}-{end:.6f} ({value}) is shorter than the ABC subbeat grid" ) result[start_t:end_t] = value if len(result) > 1: result[-1] = result[-2] return result
def _structure_events(rows, subbeat_times): events = [] for start, _, label in rows: t = _quantize_time(start, subbeat_times) t = max(0, min(t, len(subbeat_times) - 1)) events.append((t, label)) return events
def _classify_melody_tracks(midi: pretty_midi.PrettyMIDI): classified = {"Vocal": [], "Ins": []} unknown = [] for instrument in midi.instruments: if instrument.is_drum: continue name = (instrument.name or "").strip().lower() if "vocal" in name: classified["Vocal"].append(instrument) elif "ins" in name or "instrument" in name: classified["Ins"].append(instrument) elif instrument.notes: unknown.append(instrument) if unknown: if not classified["Vocal"] and not classified["Ins"] and len(unknown) == 1: classified["Ins"].extend(unknown) else: names = [instrument.name or "<unnamed>" for instrument in unknown] raise MelodyVoiceError( f"Cannot map non-empty melody track(s) {names!r} to fixed Vocal/Ins voices" ) return classified
def _notes_to_arr(notes, subbeat_times, voice_id): result = np.zeros(len(subbeat_times), dtype=np.int32) boundaries = _subbeat_boundaries(subbeat_times) for note in sorted(notes, key=lambda item: (item.start, item.end, item.pitch)): start_t = int(np.searchsorted(boundaries, note.start)) end_t = int(np.searchsorted(boundaries, note.end)) start_t = max(0, min(start_t, len(result) - 1)) end_t = max(0, min(end_t, len(result) - 1)) if end_t <= start_t: raise MelodyVoiceError( f"{voice_id}: MIDI note pitch={note.pitch} at {note.start:.6f}-{note.end:.6f} " "cannot be represented on the decoded subbeat grid" ) if np.any(result[start_t:end_t] != 0): raise MelodyVoiceError( f"{voice_id}: overlapping quantized melody notes at subbeats {start_t}:{end_t}" ) sustain = note.pitch * 2 + 2 result[start_t:end_t] = sustain result[start_t] = sustain + 1 return result
def _pitch_class(root: str) -> tuple[int, str, str]: match = _ROOT_RE.fullmatch(root) if match is None: raise ChordSymbolError(f"Invalid pitch spelling {root!r}") letter = match.group("letter") accidental = match.group("accidental") offset = accidental.count("#") - accidental.count("b") return (_NATURAL_PITCH_CLASS[letter] + offset) % 12, letter, accidental
def portable_pitch_name(root: str, *, preserve_double: bool = False) -> str: pitch_class, _, accidental = _pitch_class(root) if preserve_double or len(accidental) <= 1: return root names = _SHARP_PITCH_NAMES if accidental.startswith("#") else _FLAT_PITCH_NAMES return names[pitch_class]
def _bass_degree_to_pitch(root: str, degree_text: str) -> str: if _ROOT_RE.fullmatch(degree_text): return portable_pitch_name(degree_text, preserve_double=True) match = _BASS_DEGREE_RE.fullmatch(degree_text) if match is None: raise ChordSymbolError(f"Invalid chord bass degree {degree_text!r}") root_pc, root_letter, root_accidental = _pitch_class(root) degree = int(match.group("degree")) degree_accidental = match.group("accidental") scale_semitones = (0, 2, 4, 5, 7, 9, 11) interval = scale_semitones[(degree - 1) % 7] + 12 * ((degree - 1) // 7) interval += degree_accidental.count("#") - degree_accidental.count("b") target_pc = (root_pc + interval) % 12
target_letter_index = (_LETTERS.index(root_letter) + degree - 1) % 7 target_letter = _LETTERS[target_letter_index] natural_pc = _NATURAL_PITCH_CLASS[target_letter] difference = (target_pc - natural_pc + 6) % 12 - 6 if difference in {-2, -1, 0, 1, 2}: accidental = {-2: "bb", -1: "b", 0: "", 1: "#", 2: "##"}[difference] return target_letter + accidental names = _SHARP_PITCH_NAMES if "#" in (root_accidental + degree_accidental) else _FLAT_PITCH_NAMES return names[target_pc]
def chord_symbol_to_abc(chord: str) -> str | None: chord = chord.strip() if chord in NO_CHORDS: return None if ":" not in chord: raise ChordSymbolError(f"Chord {chord!r} is missing the ':' quality separator") root, descriptor = chord.split(":", 1) if "/" in descriptor: quality, bass_degree = descriptor.split("/", 1) else: quality, bass_degree = descriptor, None if quality not in _QUALITY_TO_ABC: raise ChordSymbolError( f"Unsupported chord quality {quality!r} in {chord!r}; refusing to rewrite it as major" ) chord_root = portable_pitch_name(root, preserve_double=True) text = chord_root + _QUALITY_TO_ABC[quality] if bass_degree: text += "/" + _bass_degree_to_pitch(root, bass_degree) return text
def key_symbol_to_abc(key: str) -> str: key = key.strip() if ":" in key: root, mode = key.split(":", 1) if mode not in {"major", "minor"}: raise AbcRebuildError(f"Unsupported key mode {mode!r} in {key!r}") elif key.endswith("m"): root, mode = key[:-1], "minor" else: root, mode = key, "major" root_pc, _, accidental = _pitch_class(root) candidate = portable_pitch_name(root) + ("m" if mode == "minor" else "") if candidate in _KEY_SIGNATURE_ACCIDENTALS: return candidate names = _FLAT_PITCH_NAMES if "b" in accidental else _SHARP_PITCH_NAMES candidate = names[root_pc] + ("m" if mode == "minor" else "") if candidate not in _KEY_SIGNATURE_ACCIDENTALS: fallback_names = _SHARP_PITCH_NAMES if names is _FLAT_PITCH_NAMES else _FLAT_PITCH_NAMES candidate = fallback_names[root_pc] + ("m" if mode == "minor" else "") if candidate not in _KEY_SIGNATURE_ACCIDENTALS: raise AbcRebuildError(f"Cannot encode portable ABC key for {key!r}") return candidate
def get_key_accidentals(key: str) -> list[int]: try: count = _KEY_SIGNATURE_ACCIDENTALS[key] except KeyError as exc: raise AbcRebuildError(f"Unsupported ABC key signature {key!r}") from exc accidentals = [0] * 7 order = "FCGDAEB" if count > 0 else "BEADGCF" for letter in order[:abs(count)]: accidentals[_LETTERS.index(letter)] = 1 if count > 0 else -1 return accidentals
def note_to_abc(note: int, key_accidentals: Sequence[int], measure_accidentals: dict) -> str: """Use key-relative spelling and write only bar-state changes.
The two target parsers propagate an accidental to the same note letter in every octave until the next barline. ``measure_accidentals`` is therefore keyed by letter and reset by the caller for every bar (and after an inline key change). This preserves pitches across parsers while still omitting repeated accidental marks. The key-relative spelling can use double accidentals in remote keys; MIDI G is F## in G# minor, for example. """
accidental_count = sum(key_accidentals) try: pitch_name = _KEY_RELATIVE_PITCH_NAMES[accidental_count][note % 12] except KeyError as exc: raise AbcRebuildError( f"Unsupported key signature accidental count {accidental_count}" ) from exc letter = pitch_name[0] accidental = pitch_name[1:] accidental_number = {"": 0, "#": 1, "##": 2, "b": -1, "bb": -2}[accidental] octave = (note - 60) // 12 # Cb and B# cross the MIDI octave boundary even though their written note # letter does not. if note % 12 == 11 and accidental_number == -1: octave += 1 elif note % 12 == 0 and accidental_number == 1: octave -= 1 scale_index = _LETTERS.index(letter) current_accidental = measure_accidentals.get( scale_index, key_accidentals[scale_index], ) accidental_text = "" if current_accidental != accidental_number: measure_accidentals[scale_index] = accidental_number accidental_text = {-2: "__", -1: "_", 0: "=", 1: "^", 2: "^^"}[ accidental_number ]
if octave > 0: letter = letter.lower() if octave > 1: letter += "'" * (octave - 1) elif octave < 0: letter += "," * abs(octave) return accidental_text + letter
def build_rebuilt_abc_score( melody_midi_path, beats_path, chords_path, keys_path, structures_path, *, meter_conflict: str = "infer", melody_only: bool = False,) -> RebuiltAbcScore: beats = read_beats(beats_path) keys = read_keys(keys_path) structures = read_structures(structures_path) chords = [] if melody_only else read_chords(chords_path) midi = pretty_midi.PrettyMIDI(str(melody_midi_path)) return _assemble_abc_score(midi, beats, keys, structures, chords, meter_conflict=meter_conflict, melody_only=melody_only)
def build_rebuilt_abc_score_from_data( melody_midi, beats, chords, keys, structures, *, meter_conflict="infer", melody_only=False,) -> RebuiltAbcScore: """Build from MIDI bytes/BytesIO/PrettyMIDI and beat/interval rows.
BeatEvent lists are also accepted. The file and memory interfaces share interval validation, score construction, serialization and ABC validation. """ beats = list(beats) if beats and isinstance(beats[0], BeatEvent): beat_entries = [(b.line_no, [str(b.time), str(b.beat_id), str(b.declared_numerator), str(b.denominator)]) for b in beats] else: beat_entries = _row_entries(beats, "beats") beats = _parse_beats(beat_entries, "beats") keys = _parse_keys(_row_entries(keys, "keys"), "keys") structures = _parse_structures(_row_entries(structures, "structures"), "structures") chords = [] if melody_only else _parse_chords(_row_entries(chords, "chords"), "chords") if isinstance(melody_midi, (bytes, bytearray)): melody_midi = BytesIO(melody_midi) if not isinstance(melody_midi, (BytesIO, pretty_midi.PrettyMIDI)): raise TypeError("melody_midi must be MIDI bytes, BytesIO, or PrettyMIDI") midi = melody_midi if isinstance(melody_midi, pretty_midi.PrettyMIDI) else pretty_midi.PrettyMIDI(melody_midi) return _assemble_abc_score(midi, beats, keys, structures, chords, meter_conflict=meter_conflict, melody_only=melody_only)
def _assemble_abc_score(midi, beats, keys, structures, chords, *, meter_conflict, melody_only): measures, diagnostics = infer_measures(beats, meter_conflict=meter_conflict) subbeat_times, subbeat_quarters, subbeat_denominators = _build_grid(beats, measures) classified = _classify_melody_tracks(midi) voice_arrs = {} for voice_id in VOICE_IDS: notes = [ note for instrument in classified[voice_id] for note in instrument.notes ] voice_arrs[voice_id] = _notes_to_arr(notes, subbeat_times, voice_id)
key_arr = _fill_intervals(keys, subbeat_times, default=keys[0][2], dtype="<U16") if melody_only: # Do not even read chord labels in melody-only mode. A constant no-chord # timeline removes chord-only render boundaries, allowing held notes and # rests to be serialized as their original semantic segments. chord_arr = np.full(len(subbeat_times), "N", dtype="<U64") else: chord_arr = _fill_intervals( chords, subbeat_times, default="N", dtype="<U64", ) return RebuiltAbcScore( beats=list(beats), measures=measures, subbeat_times=subbeat_times, subbeat_quarters=subbeat_quarters, subbeat_denominators=subbeat_denominators, key_arr=key_arr, chord_arr=chord_arr, structure_events=_structure_events(structures, subbeat_times), voice_arrs=voice_arrs, diagnostics=diagnostics, )
def abc_unit_denominator(score: RebuiltAbcScore) -> int: values = [ denominator * score.subbeat_div for measure in score.measures for denominator in (measure.denominator, measure.abc_denominator) ] denominator = math.lcm(*values) if denominator > 1024: raise AbcRebuildError(f"Required ABC unit length 1/{denominator} is unreasonably small") return denominator
def _measure_actual_units(measure: Measure, unit_denominator: int) -> int: return measure.numerator * unit_denominator // measure.denominator
def _measure_abc_units(measure: Measure, unit_denominator: int) -> int: return measure.abc_numerator * unit_denominator // measure.abc_denominator
def _measure_padding_units(measure: Measure, unit_denominator: int) -> int: return ( _measure_abc_units(measure, unit_denominator) - _measure_actual_units(measure, unit_denominator) )
def _duration_units(score: RebuiltAbcScore, start_t: int, end_t: int, unit_denominator: int) -> int: units = 0 for denominator in score.subbeat_denominators[start_t:end_t]: divisor = int(denominator) * score.subbeat_div if unit_denominator % divisor: raise AbcRebuildError( f"ABC L:1/{unit_denominator} cannot express a 1/{divisor} subbeat exactly" ) units += unit_denominator // divisor return units
def estimate_tempo(score: RebuiltAbcScore) -> float: seconds = score.subbeat_times[-1] - score.subbeat_times[0] quarter_notes = score.subbeat_quarters[-1] - score.subbeat_quarters[0] if seconds <= 0 or quarter_notes <= 0: raise AbcRebuildError("Cannot estimate tempo from a zero-duration score") return float(quarter_notes / seconds * 60.0)
def _continues_pitch(value: int, next_value: int) -> bool: if value <= 0: return False pitch = value // 2 - 1 return next_value == pitch * 2 + 2
def _same_note_segment(value: int, next_value: int) -> bool: if value == 0: return next_value == 0 pitch = value // 2 - 1 return next_value == pitch * 2 + 2
_SUPPORTED_DURATION_UNITS = frozenset( {1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48})
def _split_duration_units(duration: int) -> list[int]: """Split a duration into values accepted by strict music parsers."""
if duration <= 0: raise AbcRebuildError(f"Cannot serialize non-positive duration {duration}") result = [] remaining = int(duration) while remaining: if remaining in _SUPPORTED_DURATION_UNITS: result.append(remaining) break candidates = [ value for value in _SUPPORTED_DURATION_UNITS if value < remaining ] if not candidates: raise AbcRebuildError( f"Duration {duration} cannot be split into representable ABC values" ) chunk = max(candidates) result.append(chunk) remaining -= chunk return result
def _duration_text(duration: int) -> str: return "" if duration == 1 else str(duration)
def _render_duration_tokens( prefix: str, note_text: str, duration: int, *, tie_out: bool,) -> list[str]: chunks = _split_duration_units(duration) tokens = [] for index, chunk in enumerate(chunks): continues = note_text != "z" and ( index + 1 < len(chunks) or tie_out ) tokens.append( (prefix if index == 0 else "") + note_text + _duration_text(chunk) + ("-" if continues else "") ) return tokens
def _render_voice_measure( score: RebuiltAbcScore, voice_id: str, measure: Measure, unit_denominator: int,) -> str: voice = score.voice_arrs[voice_id] show_chords = voice_id == "Vocal" measure_accidentals = {} current_key = str(score.key_arr[measure.start_t]) key_accidentals = get_key_accidentals(current_key) parts = [] padding = _measure_padding_units(measure, unit_denominator) if padding < 0: raise AbcRebuildError( f"Measure {measure.index}: notated meter is shorter than its decoded span" ) leading_padding = padding if measure.pad_before else 0 trailing_padding = 0 if measure.pad_before else padding t = measure.start_t while t < measure.end_t: change_points = [measure.end_t] for probe in range(t + 1, measure.end_t): if not _same_note_segment(int(voice[t]), int(voice[probe])): change_points.append(probe) break for probe in range(t + 1, measure.end_t): if score.key_arr[probe] != score.key_arr[probe - 1]: change_points.append(probe) break if show_chords: for probe in range(t + 1, measure.end_t): if score.chord_arr[probe] != score.chord_arr[probe - 1]: change_points.append(probe) break next_t = min(change_points)
prefix = "" key = str(score.key_arr[t]) if t > measure.start_t and key != current_key: current_key = key key_accidentals = get_key_accidentals(current_key) measure_accidentals = {} prefix += f"[K:{current_key}]"
if show_chords and (t == measure.start_t or score.chord_arr[t] != score.chord_arr[t - 1]): chord = str(score.chord_arr[t]) chord_text = chord_symbol_to_abc(chord) if chord_text is not None: prefix += f'"{chord_text}"'
value = int(voice[t]) if value == 0: note_text = "z" else: note_text = note_to_abc(value // 2 - 1, key_accidentals, measure_accidentals) duration = _duration_units(score, t, next_t, unit_denominator) if t == measure.start_t and leading_padding: if value == 0 and not prefix: duration += leading_padding else: parts.extend( _render_duration_tokens( "", "z", leading_padding, tie_out=False, ) ) leading_padding = 0 if value == 0 and next_t == measure.end_t and trailing_padding: duration += trailing_padding trailing_padding = 0 if duration <= 0: raise AbcRebuildError(f"Non-positive ABC duration at subbeats {t}:{next_t}") tie_out = ( value > 0 and next_t < len(voice) and _continues_pitch(value, int(voice[next_t])) ) parts.extend( _render_duration_tokens( prefix, note_text, duration, tie_out=tie_out, ) ) t = next_t if leading_padding: raise AbcRebuildError( f"Measure {measure.index}: leading rest padding was not serialized" ) if trailing_padding: parts.extend( _render_duration_tokens( "", "z", trailing_padding, tie_out=False, ) ) return "".join(parts)
def _is_compressible_full_rest(rendered_measure: str) -> bool: """Whether a rendered measure can be losslessly replaced by ABC ``Z``."""
cursor = 0 saw_note = False for match in _MUSIC_ELEMENT_RE.finditer(rendered_measure): if rendered_measure[cursor:match.start()]: return False cursor = match.end() if match.group("quoted") is not None or match.group("key") is not None: return False saw_note = True if match.group("note") != "z" or match.group("tie"): return False return saw_note and cursor == len(rendered_measure)
def _render_voice_group( score: RebuiltAbcScore, voice_id: str, measures: list[Measure], unit_denominator: int,) -> str: rendered = [ _render_voice_measure( score, voice_id, measure, unit_denominator, ) for measure in measures ] parts = [] index = 0 while index < len(rendered): if not _is_compressible_full_rest(rendered[index]): parts.append(rendered[index] + "|") index += 1 continue end = index + 1 while ( end < len(rendered) and _is_compressible_full_rest(rendered[end]) ): end += 1 count = end - index parts.append("Z" + (str(count) if count > 1 else "") + "|") index = end return "".join(parts)
def _sanitize_structure_label(value: str) -> str: return " ".join(str(value).split())
def _measure_groups(score: RebuiltAbcScore) -> list[MeasureGroup]: first_measure = score.measures[0] active_meter = ( first_measure.abc_numerator, first_measure.abc_denominator, ) active_key = str(score.key_arr[first_measure.start_t]) active_structure = "" groups: list[MeasureGroup] = []
for measure in score.measures: meter = (measure.abc_numerator, measure.abc_denominator) key = str(score.key_arr[measure.start_t]) meter_changed = meter != active_meter key_changed = key != active_key new_structure_labels = [] for t, label in score.structure_events: if not measure.start_t <= t < measure.end_t: continue clean_label = _sanitize_structure_label(label) if clean_label and clean_label != active_structure: new_structure_labels.append(clean_label) active_structure = clean_label
start_group = ( not groups or len(groups[-1].measures) >= 4 or meter_changed or key_changed or bool(new_structure_labels) ) if start_group: groups.append( MeasureGroup( measures=[measure], structure_labels=new_structure_labels, meter_changed=meter_changed, key_changed=key_changed, ) ) else: groups[-1].measures.append(measure)
active_meter = meter active_key = str(score.key_arr[measure.end_t - 1]) return groups
def score_to_abc(score: RebuiltAbcScore) -> str: unit_denominator = abc_unit_denominator(score) first_measure = score.measures[0] first_key = str(score.key_arr[first_measure.start_t]) lines = [ "X:1", "T:", f"M:{first_measure.abc_numerator}/{first_measure.abc_denominator}", f"L:1/{unit_denominator}", f"Q:1/4={int(round(estimate_tempo(score)))}", 'V: Vocal clef=treble name="Vocal Melody" snm="Vocal"', 'V: Ins clef=treble name="Ins Melody" snm="Inst."', f"K:{first_key}", ] for group in _measure_groups(score): lines.extend(f"% {label}" for label in group.structure_labels) first_group_measure = group.measures[0] for voice_id in VOICE_IDS: lines.append(f"V: {voice_id}") if group.meter_changed: lines.append( f"M:{first_group_measure.abc_numerator}/" f"{first_group_measure.abc_denominator}" ) if group.key_changed: lines.append( f"K:{score.key_arr[first_group_measure.start_t]}" ) lines.append( _render_voice_group( score, voice_id, group.measures, unit_denominator, ) ) text = "\n".join(lines) + "\n" validate_serialized_abc(text, score) return text
_MUSIC_ELEMENT_RE = re.compile( r'"(?P<quoted>[^"]*)"' r"|\[K:(?P<key>[^\]]+)\]" r"|(?P<note>[_=^]*[A-Ga-gz][,']*)(?P<duration>\d*)(?P<tie>-?)")
def _parse_music_measure(line: str, expected: int, context: str): body = line if body == "Z": return [], [] position = 0 cursor = 0 quoted_events = [] key_events = [] for match in _MUSIC_ELEMENT_RE.finditer(body): gap = body[cursor:match.start()] if gap.strip(): raise AbcRebuildError(f"{context}: unsupported serialized ABC tokens {gap!r}") cursor = match.end() if match.group("quoted") is not None: quoted_events.append((position, match.group("quoted"))) continue if match.group("key") is not None: key_events.append((position, match.group("key"))) continue note = match.group("note") tie = match.group("tie") if tie and note == "z": raise AbcRebuildError(f"{context}: a rest cannot be tied") duration_text = match.group("duration") duration = int(duration_text) if duration_text else 1 if duration not in _SUPPORTED_DURATION_UNITS: raise AbcRebuildError( f"{context}: duration {duration} is not parser-representable" ) position += duration if body[cursor:].strip(): raise AbcRebuildError( f"{context}: unsupported serialized ABC tokens {body[cursor:]!r}" ) if position != expected: raise AbcRebuildError( f"{context}: duration {position} does not match meter duration {expected}" ) if re.search(r"(^|[\s|])-[_=^A-Ga-g]", line): raise AbcRebuildError(f"{context}: tie is written before its second note") return quoted_events, key_events
def _expected_measure_chords( score: RebuiltAbcScore, measure: Measure, unit_denominator: int,) -> list[tuple[int, str]]: expected = [] leading_padding = ( _measure_padding_units(measure, unit_denominator) if measure.pad_before else 0 ) for t in range(measure.start_t, measure.end_t): if t != measure.start_t and score.chord_arr[t] == score.chord_arr[t - 1]: continue position = leading_padding + _duration_units( score, measure.start_t, t, unit_denominator, ) chord = str(score.chord_arr[t]) text = chord_symbol_to_abc(chord) if text is not None: expected.append((position, text)) return expected
def _expected_measure_keys( score: RebuiltAbcScore, measure: Measure, unit_denominator: int,) -> list[tuple[int, str]]: leading_padding = ( _measure_padding_units(measure, unit_denominator) if measure.pad_before else 0 ) return [ ( leading_padding + _duration_units(score, measure.start_t, t, unit_denominator), str(score.key_arr[t]), ) for t in range(measure.start_t + 1, measure.end_t) if score.key_arr[t] != score.key_arr[t - 1] ]
def _parse_voice_group(lines, cursor, voice_id, group_index): expected_voice_field = f"V: {voice_id}" if cursor >= len(lines) or lines[cursor] != expected_voice_field: observed = lines[cursor] if cursor < len(lines) else "<end>" raise AbcRebuildError( f"Group {group_index}: expected {expected_voice_field}, got {observed!r}" ) cursor += 1 fields = {} while cursor < len(lines) and ( lines[cursor].startswith("M:") or lines[cursor].startswith("K:") ): name, value = lines[cursor].split(":", 1) if name in fields: raise AbcRebuildError( f"Group {group_index} {voice_id}: repeated {name}: field" ) fields[name] = value cursor += 1 if cursor >= len(lines): raise AbcRebuildError( f"Group {group_index} {voice_id}: missing music line" ) music_line = lines[cursor] if music_line.startswith(("V:", "M:", "K:", "%")): raise AbcRebuildError( f"Group {group_index} {voice_id}: invalid music line {music_line!r}" ) cursor += 1 split_bars = music_line.split("|") if not split_bars or split_bars[-1].strip(): raise AbcRebuildError( f"Group {group_index} {voice_id}: music line must end with a barline" ) serialized_bars = [bar.strip() for bar in split_bars[:-1]] if any(not bar for bar in serialized_bars): raise AbcRebuildError( f"Group {group_index} {voice_id}: empty serialized measure" ) bars = [] for bar in serialized_bars: match = re.fullmatch(r"Z(?P<count>[1-4])?", bar) if match is None: bars.append(bar) continue if match.group("count") == "1": raise AbcRebuildError( f"Group {group_index} {voice_id}: Z1 must be written as Z" ) bars.extend(["Z"] * int(match.group("count") or "1")) if not 1 <= len(bars) <= 4: raise AbcRebuildError( f"Group {group_index} {voice_id}: expected 1-4 semantic measures" ) return cursor, fields, bars
def validate_serialized_abc(text: str, score: RebuiltAbcScore) -> None: """Validate invariants that must hold before any ABC is written."""
lines = text.splitlines() if not lines or lines[0] != "X:1": raise AbcRebuildError("ABC must start with X:1") if len(lines) < 2 or lines[1] != "T:": raise AbcRebuildError("ABC title must be fixed as empty T:") if any(line.startswith(("%abc-", "I:abc-creator")) for line in lines): raise AbcRebuildError("ABC must not contain version or creator metadata") if "%%MIDI gchordoff" in text: raise AbcRebuildError("ABC must not contain %%MIDI gchordoff") if "% ss2" in text: raise AbcRebuildError("ABC must not contain % ss2 metadata") header_voice_ids = [ match.group(1) for line in lines if (match := re.match(r"^V: (Vocal|Ins) ", line)) ] if header_voice_ids != list(VOICE_IDS): raise AbcRebuildError(f"Expected fixed Vocal/Ins voice definitions, got {header_voice_ids!r}")
header_key_index = next( ( index for index, line in enumerate(lines) if index > 0 and line.startswith("K:") and any( header_index < index for header_index, header_line in enumerate(lines) if header_line.startswith("V: Ins ") ) ), None, ) if header_key_index is None: raise AbcRebuildError("ABC header K: field is missing") first_measure = score.measures[0] expected_header_meter = ( f"M:{first_measure.abc_numerator}/{first_measure.abc_denominator}" ) header_meters = [ line for line in lines[:header_key_index + 1] if line.startswith("M:") ] if header_meters != [expected_header_meter]: raise AbcRebuildError( f"ABC header meters {header_meters!r} " f"!= {[expected_header_meter]!r}" ) expected_header_key = f"K:{score.key_arr[first_measure.start_t]}" header_keys = [ line for line in lines[:header_key_index + 1] if line.startswith("K:") ] if header_keys != [expected_header_key]: raise AbcRebuildError( f"ABC header keys {header_keys!r} " f"!= {[expected_header_key]!r}" )
unit_denominator = abc_unit_denominator(score) expected_groups = _measure_groups(score) cursor = header_key_index + 1 for group_index, group in enumerate(expected_groups): structure_labels = [] while cursor < len(lines) and lines[cursor].startswith("% "): structure_labels.append(lines[cursor][2:].strip()) cursor += 1 if structure_labels != group.structure_labels: raise AbcRebuildError( f"Group {group_index}: structure labels " f"{structure_labels!r} != {group.structure_labels!r}" )
cursor, vocal_fields, vocal_bars = _parse_voice_group( lines, cursor, "Vocal", group_index, ) cursor, ins_fields, ins_bars = _parse_voice_group( lines, cursor, "Ins", group_index, ) if vocal_fields != ins_fields: raise AbcRebuildError( f"Group {group_index}: meter/key changes must be scoped to both voices" ) first_measure = group.measures[0] expected_fields = {} if group.meter_changed: expected_fields["M"] = ( f"{first_measure.abc_numerator}/{first_measure.abc_denominator}" ) if group.key_changed: expected_fields["K"] = str( score.key_arr[first_measure.start_t] ) if vocal_fields != expected_fields: raise AbcRebuildError( f"Group {group_index}: fields {vocal_fields!r} " f"!= required changes {expected_fields!r}" ) if ( len(vocal_bars) != len(group.measures) or len(ins_bars) != len(group.measures) ): raise AbcRebuildError( f"Group {group_index}: both voices must contain " f"{len(group.measures)} measures" )
for bar_index, measure in enumerate(group.measures): expected_duration = ( measure.abc_numerator * unit_denominator // measure.abc_denominator ) for voice_id, bars in ( ("Vocal", vocal_bars), ("Ins", ins_bars), ): quoted_events, key_events = _parse_music_measure( bars[bar_index], expected_duration, f"measure {measure.index} {voice_id}", ) expected_keys = _expected_measure_keys( score, measure, unit_denominator, ) if key_events != expected_keys: raise AbcRebuildError( f"Measure {measure.index} {voice_id}: inline keys " f"{key_events!r} != {expected_keys!r}" ) if voice_id == "Vocal": expected_chords = _expected_measure_chords( score, measure, unit_denominator, ) if quoted_events != expected_chords: raise AbcRebuildError( f"Measure {measure.index}: chord symbols " f"{quoted_events!r} != {expected_chords!r}" ) elif quoted_events: raise AbcRebuildError( f"Measure {measure.index}: chords must only be in Vocal" ) if cursor != len(lines): raise AbcRebuildError( f"Unexpected trailing ABC body lines: {lines[cursor:cursor + 5]!r}" )
def abc_paths_from_melody( melody_midi_path, output_path=None, *, melody_only=False,): melody = Path(melody_midi_path) if melody.name.endswith("_raw_full_melody.mid"): raise AbcRebuildError(f"Raw melody MIDI is not a valid ABC input: {melody}") if not melody.name.endswith("_melody.mid"): raise AbcRebuildError(f"Expected an exact *_melody.mid input, got {melody}") stem = melody.name[: -len("_melody.mid")] prefix = melody.with_name(stem) default_suffix = "_melody_only.abc" if melody_only else "_full.abc" return { "melody_midi": melody, "beats": Path(str(prefix) + "_beats.txt"), "chords": Path(str(prefix) + "_chords.txt"), "keys": Path(str(prefix) + "_keys.txt"), "structures": Path(str(prefix) + "_structures.txt"), "output": ( Path(output_path) if output_path is not None else Path(str(prefix) + default_suffix) ), }
def preflight_exports( melody_midi_path, output_path=None, *, melody_only=False,): paths = abc_paths_from_melody( melody_midi_path, output_path=output_path, melody_only=melody_only, ) required = {"melody_midi", "beats", "keys", "structures"} if not melody_only: required.add("chords") missing = [ str(path) for name, path in paths.items() if name in required and not path.is_file() ] if missing: raise FileNotFoundError( f"{paths['melody_midi']}: missing required companion file(s): {', '.join(missing)}" ) return paths
def generate_abc_from_exports( melody_midi_path, *, output_path=None, meter_conflict="infer", melody_only=False,): paths = preflight_exports( melody_midi_path, output_path=output_path, melody_only=melody_only, ) score = build_rebuilt_abc_score( paths["melody_midi"], paths["beats"], paths["chords"], paths["keys"], paths["structures"], meter_conflict=meter_conflict, melody_only=melody_only, ) return score_to_abc(score), score, paths
def generate_abc_from_data(melody_midi, beats, chords, keys, structures, *, meter_conflict="infer", melody_only=False): """Return validated ABC text and its score without filesystem access.""" score = build_rebuilt_abc_score_from_data( melody_midi, beats, chords, keys, structures, meter_conflict=meter_conflict, melody_only=melody_only, ) return score_to_abc(score), score123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259"""Whole-song inference with cached overlap prefixes and right-hand audio context."""from pathlib import Pathimport jsonimport reimport time
import torch
from .io_sheetsage2 import atomic_write_textfrom .audio_sheetsage2 import SAMPLE_RATE, load_audio, slice_audiofrom .generation_sheetsage2 import ( FULL_TASK_PROMPTS, build_overlap_prefix_tokens, constrained_prompt_generate, decode_generated_tokens, event_time_map, stitched_window_events, write_window_tokens,)from .exports_sheetsage2 import export_result
def _tensor_files(output_dir): """Inventory only files owned by the optional tensor exporter.""" files = set() tensor_dir = output_dir / "tensors" if tensor_dir.is_symlink(): return files for directory in tensor_dir.glob("window-*"): if re.fullmatch(r"window-\d{4,}", directory.name) and directory.is_dir() and not directory.is_symlink(): for path in directory.iterdir(): if path.is_file() and re.fullmatch(r"(?:index\.json|audio\.safetensors|(?:tokens|decoder)-\d{4,}\.safetensors)", path.name): files.add(path) return files
def sliding_window_plan(duration, window_seconds=300.0, overlap_seconds=200.0, lookahead_seconds=100.0): if not duration > 0 or not window_seconds > 0: raise ValueError("Duration and window length must be positive") if not 0 <= lookahead_seconds <= overlap_seconds < window_seconds: raise ValueError("Require 0 <= lookahead <= overlap < window length") hop = window_seconds - overlap_seconds start, accepted = 0.0, 0.0 result = [] while True: last = start + window_seconds >= duration - 1e-6 accept_end = duration if last else start + window_seconds - lookahead_seconds result.append(dict(start=start, end=min(duration, start + window_seconds), accept_start=accepted, accept_end=accept_end, prefix_end=accepted, generation_stop=None if last else window_seconds - lookahead_seconds)) if last: return result accepted = accept_end start = min(start + hop, duration - window_seconds)
class Transcriber: def __init__(self, model, dtype="bf16"): self.model = model self.device = next(model.parameters()).device self.dtype = {"bf16": torch.bfloat16, "fp32": None}[dtype]
@torch.inference_mode() def analyze(self, audio_path, output_dir=None, *, prompts=FULL_TASK_PROMPTS, sampling_rate=None, max_seconds=None, preset="default", overlap_seconds=None, lookahead_seconds=None, progress=None, export_logits=False, export_scores=False, export_embeddings=False, output_hidden_states=False, melody_only=False): def report(stage, **fields): if progress: progress(dict(stage=stage, **fields))
if not isinstance(melody_only, bool): raise ValueError("melody_only must be True or False") if preset not in ("default", "paper"): raise ValueError("preset must be default or paper") defaults = (200.0, 100.0) if preset == "default" else (100.0, 0.0) overlap_seconds = defaults[0] if overlap_seconds is None else overlap_seconds lookahead_seconds = defaults[1] if lookahead_seconds is None else lookahead_seconds if preset == "paper" and (overlap_seconds, lookahead_seconds) != defaults: raise ValueError("paper preset fixes overlap=100 and lookahead=0") started = time.monotonic() output_dir = Path(output_dir) if output_dir is not None else None if output_dir is not None: output_dir.mkdir(parents=True, exist_ok=True) previous_tensors = _tensor_files(output_dir) if output_dir is not None else set() current_tensors = set() tensor_results = [] prompts = self.model.tokenizer.normalize_prompts(prompts) if "timestamp" not in prompts: raise ValueError("timestamp is required to export timed annotations") report("audio") audio = load_audio(audio_path, sampling_rate=sampling_rate, max_seconds=max_seconds, preset=preset) duration = len(audio) / SAMPLE_RATE window_length = float(self.model.hparams.input_audio_length) plan = sliding_window_plan(duration, window_length, overlap_seconds, lookahead_seconds) if self.device.type == "cuda": torch.cuda.reset_peak_memory_stats(self.device) stitched, records, warnings = [], [], [] for index, window in enumerate(plan): report("encoding", window=index + 1, windows=len(plan), start=window["start"]) segment = slice_audio(audio, window["start"], window_length)[None].to(self.device) prefix, base = None, 0 if index: _, prefix, base = build_overlap_prefix_tokens( stitched, self.model.tokenizer, prompts, window["start"], window["prefix_end"]) if prefix is not None: if preset == "paper" and len(prefix) >= self.model.max_output_seq_len - 16: warnings.append(f"Window {index + 1}: overlap prefix exceeded the context") prefix = None elif preset != "paper" and len(prefix) >= self.model.max_output_seq_len - 128: raise ValueError("Overlap prefix fills the context; reduce overlap_seconds") tick = time.monotonic() memory = None tensor_record = None if export_embeddings or output_hidden_states or export_logits or export_scores: from .tensors_sheetsage2 import WindowTensorWriter tensor_record = WindowTensorWriter(output_dir, index, window, export_logits, export_scores) if export_embeddings or output_hidden_states: memory = tensor_record.audio_features(self.model, segment, self.dtype, output_hidden_states) tokens = constrained_prompt_generate( self.model, segment, prompts, self.model.max_output_seq_len, prefix_tokens=prefix, autocast_dtype=self.dtype, stop_time_seconds=(None if preset == "paper" else window["generation_stop"] if window["generation_stop"] is not None else min(duration - window["start"], window_length)), memory=memory, step_callback=tensor_record.capture if tensor_record is not None and (export_logits or export_scores) else None, progress_callback=lambda n: report("decoding", window=index + 1, windows=len(plan), tokens=n), ) if tensor_record is not None: if export_embeddings: tensor_record.decoder_features(self.model, segment, tokens, self.dtype, memory) tensor_data = tensor_record.finish() if tensor_data is not None: tensor_results.append(tensor_data) if tensor_record.directory is not None: current_tensors.update(tensor_record.directory / name for name in tensor_record.files) current_tensors.add(tensor_record.directory / "index.json") if len(tokens) > self.model.max_output_seq_len: warnings.append(f"Window {index + 1} reached the token limit; inspect its token coverage") decoded, warning = decode_generated_tokens(self.model.tokenizer, tokens, Path(audio_path).stem if isinstance(audio_path, (str, Path)) else "audio", index) if warning: warnings.append(warning["error"]) lookup = event_time_map(decoded, window_length) accepted = stitched_window_events( decoded, lookup, window["start"], window["accept_start"], window["accept_end"], duration, index, global_subbeat_base=base or 0, ) stitched.extend(accepted) if preset == "paper": stitched.sort(key=lambda e: (float(e.get("time", 0)), int(e.get("window_index", 0)), int(e.get("source_subbeat", e["subbeat"])))) record = dict(window, window_index=index, prefix_tokens=0 if prefix is None else len(prefix), tokens=tokens, events=len(decoded["events"]), accepted_events=len(accepted), elapsed_seconds=time.monotonic() - tick) records.append(record) report("window_complete", window=index + 1, windows=len(plan), tokens=len(tokens)) if preset != "paper": stitched.sort(key=lambda e: (e["time"], e["global_subbeat"])) decoded = dict(schema_version=self.model.tokenizer.schema_version, prompts=list(prompts), events=stitched, has_eos=True) report("notation") exported = export_result(decoded, self.model.tokenizer, output_dir, duration, paper=preset == "paper", melody_only=melody_only) payload = exported.pop("payload") if output_dir is not None: write_window_tokens(output_dir / "tokens.txt", records, self.model.tokenizer) atomic_write_text(output_dir / "tokens.json", json.dumps([ dict(r, tokens=r["tokens"].tolist()) for r in records ])) result = dict( audio=Path(audio_path).name if isinstance(audio_path, (str, Path)) else "audio", duration_seconds=duration, prompts=list(prompts), preset=preset, melody_only=melody_only, dtype="bf16" if self.dtype and self.device.type == "cuda" else "fp32", window_seconds=window_length, overlap_seconds=overlap_seconds, lookahead_seconds=lookahead_seconds, windows=[dict(r, tokens=len(r["tokens"])) for r in records], elapsed_seconds=time.monotonic() - started, warnings=warnings, peak_gpu_mib=torch.cuda.max_memory_allocated(self.device) / 1024**2 if self.device.type == "cuda" else 0, **exported, ) if output_dir is not None: atomic_write_text(output_dir / "result.json", json.dumps(result, indent=2)) for path in previous_tensors - current_tensors: path.unlink(missing_ok=True) for directory in {path.parent for path in previous_tensors - current_tensors}: if directory.is_dir() and not any(directory.iterdir()): directory.rmdir() report("complete", **exported) return dict(result, num_events=result["events"], **payload, tokens=[r["tokens"] for r in records], tensors=tensor_results, _metadata=result)
@torch.inference_mode()def transcribe(model, audio, output_dir=None, *, render_audio=False, render_score=False, render_parts=("mix",), dtype="bf16", melody_only=False, **kwargs): """Transcribe a path, encoded audio bytes, binary stream, or waveform.
Arrays use channels-first layout and require sampling_rate. With output_dir=None, all audio/results stay in memory: ABC is text, MIDI is bytes, events are a list, and optional features are CPU tensors grouped by window. A directory saves the standard output files and writes optional tensors to disk instead of keeping them in memory. Optional rendering also returns bytes/text when no output directory is given. melody_only=True omits chords from ABC and MIDI playback, retaining both melody voices and the original decoded events/LAB annotations. If the requested melody-only ABC cannot be built, raises RuntimeError with the completed transcription available as error.result. """ if not isinstance(melody_only, bool): raise ValueError("melody_only must be True or False") output_dir = Path(output_dir) if output_dir is not None else None if render_audio or render_score: from .rendering_sheetsage2 import render_outputs, render_memory, validate_render_options formats, render_parts = validate_render_options(audio=render_audio, score=render_score, parts=render_parts) result = Transcriber(model, dtype=dtype).analyze(audio, output_dir, melody_only=melody_only, **kwargs) metadata = result.pop("_metadata", None) if metadata is None: metadata = dict(result) if render_audio or render_score: try: assets = Path(__file__).with_name("render_assets") if not assets.is_dir(): source = getattr(model, "_source_snapshot", Path(model.config._name_or_path)) if (source / "render_assets").is_dir(): assets = source / "render_assets" else: from huggingface_hub import snapshot_download assets = Path(snapshot_download(model.config._name_or_path, revision=model.config._commit_hash, allow_patterns=["render_assets/**"], **getattr(model, "_hub_resource_options", {}))) / "render_assets" # A missing score does not prevent a requested MIDI piano preview. rendered = None if render_audio or not result.get("abc_error"): options = dict(audio=render_audio, score=() if result.get("abc_error") else formats, parts=render_parts, assets_dir=assets) if output_dir is None: rendered = render_memory(midi=result["midi"], abc=result["abc"], duration=result["duration_seconds"], **options) else: rendered = render_outputs(input_dir=output_dir, output_dir=output_dir, **options) result["rendered"] = rendered if output_dir is not None: metadata["rendered"] = rendered if formats and result.get("abc_error"): raise ValueError(f"ABC unavailable: {result['abc_error']}") except Exception as exc: result["render_error"] = str(exc) metadata["render_error"] = str(exc) if output_dir is not None: atomic_write_text(output_dir / "result.json", json.dumps(metadata, indent=2)) location = f"saved to {output_dir.resolve()}" if output_dir is not None else "completed in memory" error = RuntimeError(f"Transcription {location}; rendering failed: {exc}") error.result = result raise error from exc if output_dir is not None: atomic_write_text(output_dir / "result.json", json.dumps(metadata, indent=2)) if melody_only and not result.get("abc"): reason = result.get("abc_error") or "No ABC score was produced" error = RuntimeError(f"Melody-only ABC unavailable: {reason}") error.result = result raise error return result1234567891011{ "processor_class": "SheetSage2Processor", "sampling_rate": 24000, "window_seconds": 300.0, "time_hz": 100, "schema_version": "v1", "tokenizer_fingerprint": "5ba3325af0344c7f", "auto_map": { "AutoProcessor": "processing_sheetsage2.SheetSage2Processor" }}123456789101112131415161718192021222324252627282930313233343536373839404142434445"""Render existing SheetSage2 MIDI and ABC outputs without loading a model."""import argparseimport jsonfrom pathlib import Pathimport sys
SCRIPT_DIR = Path(__file__).absolute().parentsys.path.insert(0, str(SCRIPT_DIR))
from rendering_sheetsage2 import render_outputs
def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--input", help="Transcription output directory.") parser.add_argument("--midi", help="MIDI file with original note timing.") parser.add_argument("--abc", help="ABC score file.") parser.add_argument("--output", help="Output directory; defaults to --input or rendered/.") parser.add_argument("--audio", action="store_true", help="Render piano WAV.") parser.add_argument("--score", default="", help="Comma-separated pdf,svg,png.") parser.add_argument("--parts", default="mix", help="Comma-separated mix,melody,vocal,instrumental,chords, or all (audio only).") parser.add_argument("--duration", type=float, help="Minimum audio duration in seconds; preserves trailing silence.") args = parser.parse_args() audio = args.audio score = args.score if not audio and not score: if args.input: audio, score = True, "pdf" else: audio, score = bool(args.midi), "pdf" if args.abc else "" if not args.input and not args.midi and not args.abc: parser.error("Provide --input, --midi, or --abc.") try: result = render_outputs(args.input, midi=args.midi, abc=args.abc, output_dir=args.output, audio=audio, score=score, parts=args.parts, duration=args.duration) except (ValueError, OSError, RuntimeError) as exc: print(f"Rendering failed: {exc}", file=sys.stderr) return 1 print(json.dumps(result, indent=2)) return 0
if __name__ == "__main__": raise SystemExit(main())123version https://git-lfs.github.com/spec/v1oid sha256:7da195a74c55bef988d0d48f9508bd5d849425c1770dba5d7bfc6ce9ed848954size 757076123456789101112131415161718192021Copyright (c) 2009-2024 Paul Rosen and Gregory Dyke
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
**This text is from: http://opensource.org/licenses/MIT**123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below)
Bitstream Vera Fonts Copyright------------------------------
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera isa trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copyof the fonts accompanying this license ("Fonts") and associateddocumentation files (the "Font Software"), to reproduce and distribute theFont Software, including without limitation the rights to use, copy, merge,publish, distribute, and/or sell copies of the Font Software, and to permitpersons to whom the Font Software is furnished to do so, subject to thefollowing conditions:
The above copyright and trademark notices and this permission notice shallbe included in all copies of one or more of the Font Software typefaces.
The Font Software may be modified, altered, or added to, and in particularthe designs of glyphs or characters in the Fonts may be modified andadditional glyphs or characters may be added to the Fonts, only if the fontsare renamed to names not containing either the words "Bitstream" or the word"Vera".
This License becomes null and void to the extent applicable to Fonts or FontSoftware that has been modified and is distributed under the "BitstreamVera" names.
The Font Software may be sold as part of a larger software package but nocopy of one or more of the Font Software typefaces may be sold by itself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSOR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOMEFOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDINGANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OFTHE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THEFONT SOFTWARE.
Except as contained in this notice, the names of Gnome, the GnomeFoundation, and Bitstream Inc., shall not be used in advertising orotherwise to promote the sale, use or other dealings in this Font Softwarewithout prior written authorization from the Gnome Foundation or BitstreamInc., respectively. For further information, contact: fonts at gnome dotorg.
Arev Fonts Copyright------------------------------
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaininga copy of the fonts accompanying this license ("Fonts") andassociated documentation files (the "Font Software"), to reproduceand distribute the modifications to the Bitstream Vera Font Software,including without limitation the rights to use, copy, merge, publish,distribute, and/or sell copies of the Font Software, and to permitpersons to whom the Font Software is furnished to do so, subject tothe following conditions:
The above copyright and trademark notices and this permission noticeshall be included in all copies of one or more of the Font Softwaretypefaces.
The Font Software may be modified, altered, or added to, and inparticular the designs of glyphs or characters in the Fonts may bemodified and additional glyphs or characters may be added to theFonts, only if the fonts are renamed to names not containing eitherthe words "Tavmjong Bah" or the word "Arev".
This License becomes null and void to the extent applicable to Fontsor Font Software that has been modified and is distributed under the "Tavmjong Bah Arev" names.
The Font Software may be sold as part of a larger software package butno copy of one or more of the Font Software typefaces may be sold byitself.
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OFMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENTOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALLTAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIALDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROMOTHER DEALINGS IN THE FONT SOFTWARE.
Except as contained in this notice, the name of Tavmjong Bah shall notbe used in advertising or otherwise to promote the sale, use or otherdealings in this Font Software without prior written authorizationfrom Tavmjong Bah. For further information, contact: tavmjong @ free. fr.
TeX Gyre DJV Math-----------------Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
Math extensions done by B. Jackowski, P. Strzelczyk and P. Pianowski(on behalf of TeX users groups) are in public domain.
Letters imported from Euler Fraktur from AMSfonts are (c) AmericanMathematical Society (see below).Bitstream Vera Fonts CopyrightCopyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Verais a trademark of Bitstream, Inc.
Permission is hereby granted, free of charge, to any person obtaining a copyof the fonts accompanying this license (“Fonts”) and associateddocumentationfiles (the “Font Software”), to reproduce and distribute the Font Software,including without limitation the rights to use, copy, merge, publish,distribute,and/or sell copies of the Font Software, and to permit persons to whomthe Font Software is furnished to do so, subject to the followingconditions:
The above copyright and trademark notices and this permission noticeshall beincluded in all copies of one or more of the Font Software typefaces.
The Font Software may be modified, altered, or added to, and in particularthe designs of glyphs or characters in the Fonts may be modified andadditionalglyphs or characters may be added to the Fonts, only if the fonts arerenamedto names not containing either the words “Bitstream” or the word “Vera”.
This License becomes null and void to the extent applicable to Fonts orFont Softwarethat has been modified and is distributed under the “Bitstream Vera”names.
The Font Software may be sold as part of a larger software package butno copyof one or more of the Font Software typefaces may be sold by itself.
THE FONT SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESSOR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT,TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOMEFOUNDATIONBE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL,SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN ANACTIONOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE ORINABILITY TO USETHE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.Except as contained in this notice, the names of GNOME, the GNOMEFoundation,and Bitstream Inc., shall not be used in advertising or otherwise to promotethe sale, use or other dealings in this Font Software without prior writtenauthorization from the GNOME Foundation or Bitstream Inc., respectively.For further information, contact: fonts at gnome dot org.
AMSFonts (v. 2.2) copyright
The PostScript Type 1 implementation of the AMSFonts produced by andpreviously distributed by Blue Sky Research and Y&Y, Inc. are now freelyavailable for general use. This has been accomplished through thecooperationof a consortium of scientific publishers with Blue Sky Research and Y&Y.Members of this consortium include:
Elsevier Science IBM Corporation Society for Industrial and AppliedMathematics (SIAM) Springer-Verlag American Mathematical Society (AMS)
In order to assure the authenticity of these fonts, copyright will beheld bythe American Mathematical Society. This is not meant to restrict in any waythe legitimate use of the fonts, such as (but not limited to) electronicdistribution of documents containing these fonts, inclusion of these fontsinto other public domain or commercial font collections or computerapplications, use of the outline data to create derivative fonts and/orfaces, etc. However, the AMS does require that the AMS copyright notice beremoved from any derivative versions of the fonts which have been altered inany way. In addition, to ensure the fidelity of TeX documents using ComputerModern fonts, Professor Donald Knuth, creator of the Computer Modern faces,has requested that any alterations which yield different font metrics begiven a different name.
$Id$123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106{ "abcjs_version": "6.6.3", "abcjs_revision": "5dc285c5a4a918d33f2ab4b3c381499847e88426", "piano_revision": "cbd6b6f6d1af89ebfb69402860741288f08ff8b7", "piano_source": "https://github.com/paulrosen/midi-js-soundfonts/tree/cbd6b6f6d1af89ebfb69402860741288f08ff8b7/FluidR3_GM/acoustic_grand_piano-mp3", "files": { "DejaVuSans.ttf": "7da195a74c55bef988d0d48f9508bd5d849425c1770dba5d7bfc6ce9ed848954", "LICENSE.abcjs": "ab1072f859916529e284a8f43643146de9935041bb347a35559a96c87ce5566f", "LICENSE.font": "7a083b136e64d064794c3419751e5c7dd10d2f64c108fe5ba161eae5e5958a93", "abcjs-basic-min.js": "abdab74cf95c39fb9ff4ae0c96735b9c35222851f0844ce471ddd4354739bc75", "renderer.js": "0756398dfe69fe1c54c8779252885fbf573d02eecbe3f2389a0b81e0f43fcd09", "soundfonts/ATTRIBUTION.md": "87237050093c1d4f47f5c459f1e18b57ea6710f92d1a57b4462f8f5aa31e11be", "soundfonts/acoustic_grand_piano-mp3/A0.mp3": "5c47e8142b04505c888b8edd7246a8881b4b30c4340682f0264191599df232fc", "soundfonts/acoustic_grand_piano-mp3/A1.mp3": "abab379d4d0557abb93856f816b7bb395872e656533c3fe7f02048fc993834b7", "soundfonts/acoustic_grand_piano-mp3/A2.mp3": "e21d9ab9b30c73c0aea921c2cd0dd59fece4cc021619927c9ff3dee71f0a9679", "soundfonts/acoustic_grand_piano-mp3/A3.mp3": "02dee2fa184b9b94a5f72886c2370bd076103ebb76fc179982fa503e549dcc10", "soundfonts/acoustic_grand_piano-mp3/A4.mp3": "4f1671ac831bc41c845e67b18e6c9ea200fc9b753bdffe124703b7141aa928c3", "soundfonts/acoustic_grand_piano-mp3/A5.mp3": "2cccfe0aa8077bfd20bcbba470012faa0328ae97d5bd2297147c01f2b255e574", "soundfonts/acoustic_grand_piano-mp3/A6.mp3": "87dab2b5bfdd8bafa575fc24b99591e87e5a0c991a8bbdc8aeb8a1e517b576d2", "soundfonts/acoustic_grand_piano-mp3/A7.mp3": "ace76663dac4610a93259655f069835e6eb397b76aedf85c1f48a5036cf25687", "soundfonts/acoustic_grand_piano-mp3/Ab1.mp3": "a9889722caea82aa67a8b7f600f1def8e51e095f1f423949c3a8e9dbf5c14abd", "soundfonts/acoustic_grand_piano-mp3/Ab2.mp3": "b45bb57e125cdbbc3bb521ae643e67a90c0ff646d37e5b5284e5c70bfeff6c75", "soundfonts/acoustic_grand_piano-mp3/Ab3.mp3": "843d633061631861c943266b4836573fe8ba8b8a10df9bd94adc380376cdb8ce", "soundfonts/acoustic_grand_piano-mp3/Ab4.mp3": "e8612f8602d1c146f9b7f69a441ee518876ccdfa469457366c8064c25d9d3116", "soundfonts/acoustic_grand_piano-mp3/Ab5.mp3": "31c86a311eb68761b8008359b34addfeec249d1c7d6795a52f8f2e172e3e8a05", "soundfonts/acoustic_grand_piano-mp3/Ab6.mp3": "7775c09d08d344af9528edbf7abb6f59ac600e4d15efd6f139845bb107a822ed", "soundfonts/acoustic_grand_piano-mp3/Ab7.mp3": "66932305995ff04e9e0244c5a408ec87c9131ab3915eac15c72c7659132ab0f2", "soundfonts/acoustic_grand_piano-mp3/B0.mp3": "4422d1d2f0498aec427165415f5d665d78699e8623475215ce9b27c18b3d331f", "soundfonts/acoustic_grand_piano-mp3/B1.mp3": "048003df58298d2659bff084885ad69d9531fdc03837c7ee39c8bcf68334b5b9", "soundfonts/acoustic_grand_piano-mp3/B2.mp3": "be2df872b00b68adead4ca24ef68bd4a93bf0c4864d455d742171e5df91e86b7", "soundfonts/acoustic_grand_piano-mp3/B3.mp3": "82c0463af9c9fe51d44aa59b71d2dccefab11c1ea98e2748ee93244f8af9169e", "soundfonts/acoustic_grand_piano-mp3/B4.mp3": "5f09187820410b0f78575f232c3509f367478b7755b6eb5aa46ce6cf4c16a0e8", "soundfonts/acoustic_grand_piano-mp3/B5.mp3": "4e0932827d3e9390080c4a9acd420e9b83871a5f73723feaf61d2d7f6b628b01", "soundfonts/acoustic_grand_piano-mp3/B6.mp3": "d31aa62152acd598d55fb02cc024e59e0176a7dc13d27813882f299cae7baf7a", "soundfonts/acoustic_grand_piano-mp3/B7.mp3": "6e1aad1cc92f17ebf6fe6161766cce279250e67a30569649481c77ab80db1677", "soundfonts/acoustic_grand_piano-mp3/Bb0.mp3": "e4734f8d0285f0e5a39db7f61023510b46fb1570743b20d287479dcaa5536adb", "soundfonts/acoustic_grand_piano-mp3/Bb1.mp3": "6d4face1b6559a08af3f9a49fcbc472b43e974e072156b31850ab9a230713aa3", "soundfonts/acoustic_grand_piano-mp3/Bb2.mp3": "78cc11431a2a2d52294f0c714c59107a886f637806ae2cba63d50ff53585b93e", "soundfonts/acoustic_grand_piano-mp3/Bb3.mp3": "6ac0f67f18e15db35553d4fcd83ceec4473ebe639e31659ce93cf8466cb06644", "soundfonts/acoustic_grand_piano-mp3/Bb4.mp3": "d8f729899595116cb62ca9b7b801b4dfb9322bdf50d1bbfa847010e43a39f8f5", "soundfonts/acoustic_grand_piano-mp3/Bb5.mp3": "51224d4c26f1c89b08e43865ef55d3638367f7f40fbc92e4ab88610b54d4301d", "soundfonts/acoustic_grand_piano-mp3/Bb6.mp3": "394488d6cbd2c58b40f202e5acc238abdb73f261bcebd7105fb81d091113c4aa", "soundfonts/acoustic_grand_piano-mp3/Bb7.mp3": "fe72a195f6036722e587e1597e54d66ec70e0ce11768e74e39bb2319bf256f80", "soundfonts/acoustic_grand_piano-mp3/C1.mp3": "eb3b985e3b692cfe0c48550a26843fc3da44c7630c0b7bcfd820e87c5122cccc", "soundfonts/acoustic_grand_piano-mp3/C2.mp3": "e02c5a80c03871e1889a3bb371d853f92294c1e8538ac06f70df0fd045540207", "soundfonts/acoustic_grand_piano-mp3/C3.mp3": "7d0409ea3c40af25c6d3d606f12890f88f896d93c381b6eb8c58497f308b30d3", "soundfonts/acoustic_grand_piano-mp3/C4.mp3": "b6d32e0d9d0c2e4b88165a2ec27b8787a970f131a03d96d065f28f158640af96", "soundfonts/acoustic_grand_piano-mp3/C5.mp3": "7a4be6dae323ac5564ad1a617b554fd595e5e0a63f19c3581e3ee94c33ae2e4b", "soundfonts/acoustic_grand_piano-mp3/C6.mp3": "6a0030c071ccd6c9a722455851d65b18cb86cbfe515772a6ded4c747eda339a0", "soundfonts/acoustic_grand_piano-mp3/C7.mp3": "5e4cadc06eb25e2302dcc5bf1af76fe85ed258759d02c46e9169376ade83845e", "soundfonts/acoustic_grand_piano-mp3/C8.mp3": "4ec066cab9362f6706b90fedc3249fa3c221769ee95ff52d7e46aaaf0a01fd16", "soundfonts/acoustic_grand_piano-mp3/D1.mp3": "2389562397c7bdf2a856965b8b371eb6311be3cad2875c71d8ff4a607a242cea", "soundfonts/acoustic_grand_piano-mp3/D2.mp3": "6233cc6f3670a287e33c7b8ece3b03a787ee1e169c8355432ce0b5e194bee612", "soundfonts/acoustic_grand_piano-mp3/D3.mp3": "b8a5ed9cf147e10f484f3ad39930130d487b12045a35cef73f48dab401e6583b", "soundfonts/acoustic_grand_piano-mp3/D4.mp3": "90539782bdbbbe714de579bfbbe6f478e07e112c6f78d03e8ee82462fbf2a569", "soundfonts/acoustic_grand_piano-mp3/D5.mp3": "b25b5e541807af700f4e2272ac4c55a2f9b5cc8f176fcd9961d4456803af2b87", "soundfonts/acoustic_grand_piano-mp3/D6.mp3": "46317b9dca22a75986ecfeba93ef34c8f7bc6d4e2e0223dc64b13c9a1984110b", "soundfonts/acoustic_grand_piano-mp3/D7.mp3": "d7db5e63d7caa2fc62e00f55366f9a5236b3a13f7eb0d141a9823e10c7cc4209", "soundfonts/acoustic_grand_piano-mp3/Db1.mp3": "84f2ba7505c515c39797eafe36295b15ee9da8adbafcfbfbfc7685532b4bdce4", "soundfonts/acoustic_grand_piano-mp3/Db2.mp3": "c5d76b97326a189786aba25685c8789f59d4dc41d5fbd4d6a6aa97986b2b7d1d", "soundfonts/acoustic_grand_piano-mp3/Db3.mp3": "c5bd77b92ad8411c47e509643a7d6fc9c74f3aaba2290e2f4aed6a2ba1446e88", "soundfonts/acoustic_grand_piano-mp3/Db4.mp3": "f49892c4e935296db1cb785000818e6a04bf0756c4443bffa6245144fdaf3e47", "soundfonts/acoustic_grand_piano-mp3/Db5.mp3": "924a70321fe728ff7a69c941029e060f529e6ada507f20357ee74039e270e588", "soundfonts/acoustic_grand_piano-mp3/Db6.mp3": "5e4b55cc27db80e899ea817c546f4c0cf15b43267f426f8de53baac770f90be7", "soundfonts/acoustic_grand_piano-mp3/Db7.mp3": "56c93ba30fa46db98590fd4c218fec88e87b02eaa0b177bcc0ad621fd9a506da", "soundfonts/acoustic_grand_piano-mp3/Db8.mp3": "1be0e2193b729fc32a4fbb82f9f46bb4c0b2cbb67027c0f07c8eeff6460b64cf", "soundfonts/acoustic_grand_piano-mp3/E1.mp3": "740bf03f7ac2a9bbd41ae10f7daf876bc8bde6fe6d355f2f2781ae70d95c762a", "soundfonts/acoustic_grand_piano-mp3/E2.mp3": "316b392d51d9c27334976511643112b088a9812a8e37e598957e8acc6725aad0", "soundfonts/acoustic_grand_piano-mp3/E3.mp3": "5e556a4850b93b1adba6655372c9e58913169864c52a8e6f232f4b1e901ca2dc", "soundfonts/acoustic_grand_piano-mp3/E4.mp3": "48bcecf53832988af83f74aa65efd7daa34f1e3ebf10de4679363b89d54f3852", "soundfonts/acoustic_grand_piano-mp3/E5.mp3": "c48cee1a11528da53e1f780a1ed36558530f053b5ed8c7033709b2002b452513", "soundfonts/acoustic_grand_piano-mp3/E6.mp3": "e4de8378854d6b39b40d4cf7b022f60bda097993b492639c8a0a005f02a010e0", "soundfonts/acoustic_grand_piano-mp3/E7.mp3": "e757f51d2fb54dca2c0adb4ee6a2b86459a52e2f7dfa227529558a6a0f28fd07", "soundfonts/acoustic_grand_piano-mp3/Eb1.mp3": "694e89cd30008f47411336ea1b76675503bbc5383c3849df676b2cf6b51eee67", "soundfonts/acoustic_grand_piano-mp3/Eb2.mp3": "708ff787e5ae2bfa45fe386e5fadc90a9339817dd245ed6e6f62532e42fad8d2", "soundfonts/acoustic_grand_piano-mp3/Eb3.mp3": "bec9944789ef9e7ec3dd7f9fcdf63ed1e5e82e29447c81be3578df9b1269b4b6", "soundfonts/acoustic_grand_piano-mp3/Eb4.mp3": "96586e2865651cfa0469e762f3bd40821f6e45eecf4761a86a37bc59cfebfb2c", "soundfonts/acoustic_grand_piano-mp3/Eb5.mp3": "aad99b852c20c2aee66143dd103513523566716cb2f4c6ef6ac478ef84f282b0", "soundfonts/acoustic_grand_piano-mp3/Eb6.mp3": "c0f4c45d7930ed90edebfd93321807cdb7346e364ba1933867c4b49ba18d5368", "soundfonts/acoustic_grand_piano-mp3/Eb7.mp3": "c23b9b43ca8ece152e59ef04832b2290e96db54f9539af3162df4054c23271c7", "soundfonts/acoustic_grand_piano-mp3/F1.mp3": "6b83be26ca990ee91e4d404afd5756e5d63b7a6f9ac46da068c80b2692945dba", "soundfonts/acoustic_grand_piano-mp3/F2.mp3": "7bb9c26ec86e1d32194ab5ced3805e1026e638a4a5481d556a7e3f2860141c46", "soundfonts/acoustic_grand_piano-mp3/F3.mp3": "ff912c3211f80dc0c4f541ebd39c1db11f21cfda684d54999f9bce87aaf0cf20", "soundfonts/acoustic_grand_piano-mp3/F4.mp3": "a7426425ed95ea8652a888d850c34c4b766c7c7a11c168ed6899c38a6836be0c", "soundfonts/acoustic_grand_piano-mp3/F5.mp3": "d7f046daec924ce8607ec92360e0d0e42e29e4b3a108839179e04aba4adadc51", "soundfonts/acoustic_grand_piano-mp3/F6.mp3": "6f7794d298d1036ebbd514ad1b3605ffbd280556925fba05e29b83052cbf3dfd", "soundfonts/acoustic_grand_piano-mp3/F7.mp3": "f49b2b54f0b913f636b5822eae373a85dbb30ec5e9a6ebc18e498fdfe0547011", "soundfonts/acoustic_grand_piano-mp3/G1.mp3": "d187e74ca3a23d08248ea4073abc0893a758c8b15c4b6af16c3ba1d2394830db", "soundfonts/acoustic_grand_piano-mp3/G2.mp3": "034f90b9f81e5aca0012f1ff73d731308653578a7eb4bee30efca37af5afce77", "soundfonts/acoustic_grand_piano-mp3/G3.mp3": "3b75e4dfd657723b3c7a30bca0409dce8013b4083d54e703c8ec513b535cee99", "soundfonts/acoustic_grand_piano-mp3/G4.mp3": "37d21e13d5cecc8c0f1645c83bfe82f6032407a3b7de3dde14021c196526664e", "soundfonts/acoustic_grand_piano-mp3/G5.mp3": "2eb949282bc676f3dc96bf5008459b5fff02696e63b70ff799ff08c36bb97058", "soundfonts/acoustic_grand_piano-mp3/G6.mp3": "c24ccf8d6f0c6c9818fe244d150a42c42585629db413e6b245088fdb589e9f3d", "soundfonts/acoustic_grand_piano-mp3/G7.mp3": "7cc4630a06cbc11438fac85c00b640cc7677be8332105204632b687d7127ebc4", "soundfonts/acoustic_grand_piano-mp3/Gb1.mp3": "6ff97bc16a3020037f46ebe4196ce2602eed8af243b567768d4cb5d47a8ba0bc", "soundfonts/acoustic_grand_piano-mp3/Gb2.mp3": "95ab26a90d088fdc938673005ba2b2a4b166ee188ffbad0c7f75fb746334b043", "soundfonts/acoustic_grand_piano-mp3/Gb3.mp3": "91605f55bf0265c1e526b966a3901f9c2813473ac890f4b7330ee08874c5d30f", "soundfonts/acoustic_grand_piano-mp3/Gb4.mp3": "f0db7ee32b9175907ca60cf53e6c7a129ea8e7c8f6562dc7ebe6e5c81dcbdf99", "soundfonts/acoustic_grand_piano-mp3/Gb5.mp3": "bd1d81203f5338ab62372f88c0b4eb5b4a3133ef58518a8770f3dfdf34f74124", "soundfonts/acoustic_grand_piano-mp3/Gb6.mp3": "c5f87e3bf666919bd1e230f6945ee4af752761faa54dc1814f854e8e9d8a7920", "soundfonts/acoustic_grand_piano-mp3/Gb7.mp3": "8615b92d93fa16b4051bdc8800a6430642bdcff17e26d020ec5fd83bf89db759" }, "font_version": "DejaVu Sans 2.37", "font_license_source": "https://raw.githubusercontent.com/dejavu-fonts/dejavu-fonts/version_2_37/LICENSE", "abcjs_git_blob": "a56bbfc0d004c9b14ea17ad4fd6b52a61b74d255"}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165"use strict";
// These display adaptations leave the saved ABC unchanged.function expandRests(abc) { let header = true, voice = null, meter = [4, 4], unit = [1, 8]; const meters = new Map(); return abc.split(/\r?\n/).map(line => { const field = line.match(/^([A-Za-z]):\s*(.*)$/); if (field) { const [, key, value] = field; if (key === "V") { voice = value.split(/\s/)[0]; if (!meters.has(voice)) meters.set(voice, meter); } if (key === "M") { const match = value.match(/^(\d+)\/(\d+)$/); if (match) { const next = match.slice(1).map(Number); if (header || !voice) meter = next; else meters.set(voice, next); } } if (key === "L") unit = value.split("/").map(Number); if (key === "K") header = false; return line; } if (header || line.startsWith("%")) return line; return line.replace(/"[^"\n]*"|\[[^\]\n]*\]|Z(\d*)\|/g, (token, count) => { if (count === undefined) return token; const [n, d] = meters.get(voice) || meter; return (`z${n * unit[1] / (d * unit[0])}|`).repeat(Number(count || 1)); }); }).join("\n");}
function fixSystemKeys(tune) { for (const line of tune.lines) for (const staff of line.staff || []) { for (const voice of staff.voices) { for (let i = 0; i < voice.length && voice[i].el_type !== "note";) { const event = voice[i]; if (event.el_type === "key" || event.el_type === "keySignature") { staff.key = {...event, accidentals: event.accidentals.map(a => ({...a}))}; delete staff.key.impliedNaturals; voice.splice(i, 1); } else i++; } } }}
window.renderScore = async abc => { document.body.innerHTML = '<div id="source"></div><main id="pages"></main>'; const fontStyle = document.createElement("style"); fontStyle.textContent = '#source text, #source span, #pages text {font-family:SheetSageSans !important}'; document.head.append(fontStyle); const source = document.getElementById("source"); source.style.cssText = "position:absolute;left:-2000px;width:714px"; const tunes = ABCJS.renderAbc(source, expandRests(abc), { staffwidth: 674, paddingtop: 12, paddingbottom: 12, paddingleft: 20, paddingright: 20, oneSvgPerLine: true, print: true, add_classes: true, wrap: {minSpacing: 1.8, maxSpacing: 2.7, preferredMeasuresPerLine: 4}, afterParsing: fixSystemKeys, }); if (!tunes.length || !tunes.some(t => t.lines.some(l => l.staff?.length))) throw new Error("ABC contains no music to render."); const warnings = tunes.flatMap(t => t.warnings || []); if (warnings.length) throw new Error("Invalid ABC: " + warnings.join("; ")); await document.fonts.ready; const ns = "http://www.w3.org/2000/svg"; const pages = []; let page, content, used = 0, systems = 0; function addPage() { page = document.createElementNS(ns, "svg"); for (const [k, v] of Object.entries({xmlns:ns, width:794, height:1123, viewBox:"0 0 794 1123"})) page.setAttribute(k,v); page.setAttribute("class", "score-page"); const fontStyle = document.createElementNS(ns, "style"); fontStyle.textContent = '@font-face{font-family:SheetSageSans;src:url(data:font/ttf;base64,' + window.renderFontData + ')}text{font-family:SheetSageSans !important}'; page.append(fontStyle); const license = document.createElementNS(ns, "metadata"); license.textContent = window.renderFontLicense; page.append(license); const background = document.createElementNS(ns, "rect"); for (const [k,v] of Object.entries({width:794,height:1123,fill:"white"})) background.setAttribute(k,v); page.append(background); content = document.createElementNS(ns, "g"); content.setAttribute("transform", "translate(40 40)"); page.append(content); document.getElementById("pages").append(page); pages.push(page); used = 0; } for (const svg of source.querySelectorAll("svg")) { const box = svg.getBoundingClientRect(); if (!(box.width > 0 && box.height > 0)) continue; const scale = Math.min(1, 714 / box.width); const height = box.height * scale; if (height > 1043) throw new Error("A staff system is taller than one page."); if (!page || used + height > 1043) addPage(); const group = document.createElementNS(ns, "g"); group.setAttribute("transform", `translate(0 ${used}) scale(${scale})`); const clone = svg.cloneNode(true); clone.setAttribute("width",box.width); clone.setAttribute("height",box.height); clone.style.overflow = "visible"; group.append(clone); content.append(group); used += height; systems++; } source.remove(); if (!pages.length) throw new Error("No score pages were produced."); return {pages:pages.map(p => new XMLSerializer().serializeToString(p)), systems, warnings};};
window.renderAudio = async ({tracks, duration}) => { const context = new AudioContext({sampleRate:44100}); await context.resume(); const sequence = new ABCJS.synth.SynthSequence(); for (const track of tracks) { const id = sequence.addTrack(); sequence.setInstrument(id, 0); for (const note of track.notes) sequence.tracks[id].push({ cmd:"note", instrument:0, pitch:note.pitch, volume:note.velocity, start:note.start, duration:note.end-note.start, gap:0, }); } sequence.totalDuration = duration; const synth = new ABCJS.synth.CreateSynth(); const loaded = await synth.init({audioContext:context, sequence, millisecondsPerMeasure:1000, options:{soundFontUrl:"https://render.invalid/soundfonts/", fadeLength:35, programOffsets:{acoustic_grand_piano:0}, soundFontVolumeMultiplier:1}}); if (loaded.error?.length) throw new Error("Could not load piano samples: " + loaded.error.join(", ")); await synth.prime(); const buffer = synth.getAudioBuffer(); if (!buffer) throw new Error("The renderer returned no audio."); // Simultaneous voices retain their balance; a peak guard avoids PCM clipping. let peak = 0; for (let c=0; c<buffer.numberOfChannels; c++) { const channel = buffer.getChannelData(c); for (let i=0; i<channel.length; i++) peak = Math.max(peak, Math.abs(channel[i])); } const gain = Math.min(0.7, peak > 0 ? 0.98 / peak : 0.7); window.renderedAudio = {buffer, gain}; await context.close(); return {frames:buffer.length, sample_rate:buffer.sampleRate, channels:buffer.numberOfChannels, gain};};
window.audioBlock = ({start, count}) => { const {buffer, gain} = window.renderedAudio; const frames = Math.min(count, buffer.length-start); const bytes = new Uint8Array(frames*buffer.numberOfChannels*2); const view = new DataView(bytes.buffer); for (let c=0; c<buffer.numberOfChannels; c++) { const channel = buffer.getChannelData(c); for (let i=0; i<frames; i++) { const sample = Math.max(-1,Math.min(1,channel[start+i]*gain)); view.setInt16((i*buffer.numberOfChannels+c)*2, Math.round(sample*32767), true); } } let binary=""; for (let offset=0; offset<bytes.length; offset+=8192) binary += String.fromCharCode(...bytes.subarray(offset,offset+8192)); return btoa(binary);};1234567891011# Piano samples
FluidR3 GM by Frank Wen. License: Creative Commons Attribution 3.0 US.
https://creativecommons.org/licenses/by/3.0/us/
Pre-rendered MP3 samples from Paul Rosen's fork of gleitz/midi-js-soundfonts:
https://github.com/paulrosen/midi-js-soundfonts
https://raw.githubusercontent.com/paulrosen/midi-js-soundfonts/gh-pages/FluidR3_GM/acoustic_grand_piano-mp3.js
The base64 samples were unpacked into individual MP3 files without changing the
audio, for same-origin/offline ABCJS score playback. Only piano is bundled..gitattributes+2
MANIFEST.tsv+133
README.md+1
SHA256SUMS+133
THIRD_PARTY_NOTICES.md+17
checkpoints/SheetSage2/LICENSEAdded+424
checkpoints/SheetSage2/THIRD_PARTY_NOTICES.mdAdded+8
checkpoints/SheetSage2/__init__.pyAdded+1
checkpoints/SheetSage2/assets/architecture.pngAdded

Large File Pointer Details
- SHA256: 4ca7396e9a7055f6824607f17c644dd59f3c28097c6adf10ee30c19056f998ef
- Pointer size: 131 Bytes
- Size of remote file: 311 kB
checkpoints/SheetSage2/audio_sheetsage2.pyAdded+92
checkpoints/SheetSage2/benchmarks/chordformer.mdAdded+62
checkpoints/SheetSage2/benchmarks/chordformer_per_song.csvAdded
checkpoints/SheetSage2/benchmarks/chordformer_results.jsonAdded+101
checkpoints/SheetSage2/benchmarks/rock_corpus.mdAdded+33
checkpoints/SheetSage2/benchmarks/rock_corpus_per_song.csvAdded+401
checkpoints/SheetSage2/benchmarks/rock_corpus_results.jsonAdded+37
checkpoints/SheetSage2/benchmarks/score_chordformer.pyAdded+122
checkpoints/SheetSage2/chord_spelling_sheetsage2.pyAdded+196
checkpoints/SheetSage2/config.jsonAdded+75
checkpoints/SheetSage2/configuration_mert2.pyAdded+76
checkpoints/SheetSage2/configuration_sheetsage2.pyAdded+88
checkpoints/SheetSage2/durations_sheetsage2.pyAdded+14
checkpoints/SheetSage2/exports_sheetsage2.pyAdded+209
checkpoints/SheetSage2/generation_sheetsage2.pyAdded+634
checkpoints/SheetSage2/infer.pyAdded+78
checkpoints/SheetSage2/io_sheetsage2.pyAdded+67
checkpoints/SheetSage2/labels_sheetsage2.pyAdded+29
checkpoints/SheetSage2/midi_sheetsage2.pyAdded+92
checkpoints/SheetSage2/model.safetensorsAdded+3
checkpoints/SheetSage2/modeling_mert2.pyAdded+361
checkpoints/SheetSage2/notation_sheetsage2.pyAdded+1570
checkpoints/SheetSage2/pipeline_sheetsage2.pyAdded+259
checkpoints/SheetSage2/processor_config.jsonAdded+11
checkpoints/SheetSage2/render.pyAdded+45
checkpoints/SheetSage2/render_assets/DejaVuSans.ttfAdded+3
checkpoints/SheetSage2/render_assets/LICENSE.abcjsAdded+21
checkpoints/SheetSage2/render_assets/LICENSE.fontAdded+187
checkpoints/SheetSage2/render_assets/abcjs-basic-min.jsAdded
checkpoints/SheetSage2/render_assets/manifest.jsonAdded+106
checkpoints/SheetSage2/render_assets/renderer.jsAdded+165
checkpoints/SheetSage2/render_assets/soundfonts/ATTRIBUTION.mdAdded+11
checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A0.mp3Added
checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A1.mp3Added
checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A2.mp3Added
checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A3.mp3Added
checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A4.mp3Added
checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A5.mp3Added
checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A6.mp3Added
checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/A7.mp3Added
checkpoints/SheetSage2/render_assets/soundfonts/acoustic_grand_piano-mp3/Ab1.mp3Added