score-reader 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. score_reader-0.1.5.dist-info/METADATA +154 -0
  2. score_reader-0.1.5.dist-info/RECORD +64 -0
  3. score_reader-0.1.5.dist-info/WHEEL +5 -0
  4. score_reader-0.1.5.dist-info/entry_points.txt +2 -0
  5. score_reader-0.1.5.dist-info/licenses/LICENSE +202 -0
  6. score_reader-0.1.5.dist-info/licenses/NOTICE +13 -0
  7. score_reader-0.1.5.dist-info/top_level.txt +1 -0
  8. sheet_interpreter/__init__.py +9 -0
  9. sheet_interpreter/arpeggio_notation.py +111 -0
  10. sheet_interpreter/articulation_export.py +49 -0
  11. sheet_interpreter/audio.py +260 -0
  12. sheet_interpreter/beam_source.py +163 -0
  13. sheet_interpreter/boundary_ties.py +82 -0
  14. sheet_interpreter/bow_export.py +35 -0
  15. sheet_interpreter/clef_export.py +76 -0
  16. sheet_interpreter/cli.py +142 -0
  17. sheet_interpreter/clock_context.py +261 -0
  18. sheet_interpreter/continuous_slide_curve.py +89 -0
  19. sheet_interpreter/cue_caption.py +54 -0
  20. sheet_interpreter/data/LICENSE +202 -0
  21. sheet_interpreter/data/NOTICE +13 -0
  22. sheet_interpreter/data/music_sheets_v4_float16.tflite +0 -0
  23. sheet_interpreter/dynamic_export.py +76 -0
  24. sheet_interpreter/fall_off_notation.py +128 -0
  25. sheet_interpreter/grace_export.py +83 -0
  26. sheet_interpreter/guide_writer.py +287 -0
  27. sheet_interpreter/guitar_effect.py +32 -0
  28. sheet_interpreter/guitar_export.py +36 -0
  29. sheet_interpreter/hairpin_export.py +102 -0
  30. sheet_interpreter/interpreter.jar +0 -0
  31. sheet_interpreter/midi.py +340 -0
  32. sheet_interpreter/multi_rest_wire.py +62 -0
  33. sheet_interpreter/musicxml.py +937 -0
  34. sheet_interpreter/natural_harmonic_notation.py +125 -0
  35. sheet_interpreter/navigation.py +186 -0
  36. sheet_interpreter/neutral_rest_caption.py +58 -0
  37. sheet_interpreter/ocr.py +103 -0
  38. sheet_interpreter/octave_shift_export.py +94 -0
  39. sheet_interpreter/ornament_export.py +53 -0
  40. sheet_interpreter/page_processing_budget.py +17 -0
  41. sheet_interpreter/parenthesized_note_group.py +198 -0
  42. sheet_interpreter/pdf_annotations.py +52 -0
  43. sheet_interpreter/performance.py +478 -0
  44. sheet_interpreter/printed_tempo_spans.py +124 -0
  45. sheet_interpreter/reader.py +204 -0
  46. sheet_interpreter/rest_kinds.py +33 -0
  47. sheet_interpreter/runtime.py +17 -0
  48. sheet_interpreter/semantic_wire.py +321 -0
  49. sheet_interpreter/slide_numbering.py +43 -0
  50. sheet_interpreter/slide_performance.py +204 -0
  51. sheet_interpreter/slur_export.py +124 -0
  52. sheet_interpreter/slur_wire.py +159 -0
  53. sheet_interpreter/source_tempo_clock.py +93 -0
  54. sheet_interpreter/spelling_export.py +48 -0
  55. sheet_interpreter/straight_slide.py +76 -0
  56. sheet_interpreter/sudden_dynamic.py +47 -0
  57. sheet_interpreter/technique_export.py +62 -0
  58. sheet_interpreter/tie_owners.py +43 -0
  59. sheet_interpreter/tremolo_export.py +93 -0
  60. sheet_interpreter/tremolo_performance.py +45 -0
  61. sheet_interpreter/tremolo_wire.py +138 -0
  62. sheet_interpreter/typed_events.py +57 -0
  63. sheet_interpreter/typed_performance.py +44 -0
  64. sheet_interpreter/visual_size.py +18 -0
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: score-reader
3
+ Version: 0.1.5
4
+ Summary: Experimental offline sheet-music recognition with permissively licensed weights and a standalone Java decoder
5
+ Author: Luckolite
6
+ License: Apache-2.0
7
+ Project-URL: Repository, https://github.com/Luckolite/Music-Sheets-Interpreter
8
+ Project-URL: Issues, https://github.com/Luckolite/Music-Sheets-Interpreter/issues
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Topic :: Multimedia :: Sound/Audio :: MIDI
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Java
13
+ Requires-Python: <3.12,>=3.10
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ License-File: NOTICE
17
+ Requires-Dist: numpy<2,>=1.23.5
18
+ Requires-Dist: Pillow<13,>=10
19
+ Provides-Extra: inference
20
+ Requires-Dist: tensorflow==2.15.1; extra == "inference"
21
+ Requires-Dist: rapidocr==3.9.2; extra == "inference"
22
+ Requires-Dist: onnxruntime==1.23.2; extra == "inference"
23
+ Provides-Extra: pdf
24
+ Requires-Dist: pypdfium2<5,>=4.30; extra == "pdf"
25
+ Provides-Extra: audio
26
+ Requires-Dist: imageio-ffmpeg<0.7,>=0.5; extra == "audio"
27
+ Dynamic: license-file
28
+
29
+ # Music Sheets Interpreter
30
+
31
+ Offline sheet-music recognition for images and PDFs, with downloadable model weights,
32
+ a Java decoder and a Python interface. Exports JSON, MIDI, MP3 and MusicXML.
33
+
34
+ **Code and weights are Apache-2.0 licensed, including commercial and closed-source use.**
35
+ You do not need to publish your own code. Follow the [license and notice requirements](docs/licensing.md).
36
+
37
+ ## What it supports 🎹🎸🎻🎷
38
+
39
+ - Piano, Violin, Guitar 6- and 7 string tabs, ensemble pages, and independently barred staves.
40
+
41
+ - Standard notation: pitches, accidentals, chords, rests, ties, repeats and endings, tempo and key changes.
42
+
43
+ - Note-equals-number tempo marks, and note-equals-note metric modulations, including dotted pulses.
44
+
45
+ - Expressive previews: rit./rall. slowing, rite/ritenuto, fermata holds, breath pauses, sf/sfz/sfp attacks and paired tremolos. See [the shared playback policy](docs/expressive-performance.md).
46
+ - Piano pedal brackets carry through to MIDI sustain, audio previews and MusicXML.
47
+
48
+ - Tuning headers, detached tab stems, partial beams, rests, dots, triplets, grace frets, tied continuations, hammer-on, pull-off, tapping, slide, bend, vibrato, and harmonic symbols. Missing tab rhythm is estimated. Labelled graphical bend arrows include quarter-tone amounts and return strokes; explicit whammy-bar arrows retain their pitch direction, and up/down strum marks order chord attacks. See [gesture evidence and limits](docs/tab-gestures.md).
49
+
50
+ - JSON for integration, MIDI/MP3 for preview, and MusicXML for editing with retained clefs, slurs, articulations, ornaments and grace notes.
51
+ - Staff-owned arco, pizzicato and expression labels in MusicXML follow the first proved affected note's exported clock.
52
+ - Absolute dynamics at retained note columns use their proved written onsets in MusicXML, including staff ownership and edited timing.
53
+ - Explicit unpitched events and caller-selected previews: [API examples](docs/unpitched-events.md).
54
+
55
+ - MusicXML reconstructs a concert-pitch score, not the original layout or tab placement.
56
+ Guitar effects are text annotations in MusicXML.
57
+
58
+ ## Install and use
59
+
60
+ Requires **Python 3.10 or 3.11** and **JDK 17+**. Build from source for the latest features;
61
+ [release downloads](https://github.com/Luckolite/Music-Sheets-Interpreter/releases) may be older.
62
+
63
+ ```sh
64
+ git clone https://github.com/Luckolite/Music-Sheets-Interpreter.git
65
+ cd Music-Sheets-Interpreter
66
+ python -m venv .venv
67
+ ```
68
+
69
+ Activate with `.venv\Scripts\Activate.ps1` on Windows or `source .venv/bin/activate`
70
+ on macOS/Linux, then run:
71
+
72
+ ```sh
73
+ python scripts/build_java.py
74
+ python -m pip install ".[inference,pdf]"
75
+ sheet-interpreter score.pdf --output score.json --midi preview.mid --musicxml score.musicxml
76
+ ```
77
+
78
+ Images work too. `--midi` and `--musicxml` are optional. Use `--meter 3/4`, `--bpm 90`,
79
+ `--key-fifths 2` or `--pages 1,2,3` when needed. Default meter and tempo are 4/4 and 120 BPM.
80
+
81
+ Detected tempo changes report `bpm` in quarter notes per minute, including fractional values,
82
+ and `beatUnit` as the printed pulse length in quarter notes. For example, eighth note = 163
83
+ reports `bpm: 81.5, beatUnit: 0.5`. MIDI and MusicXML use the quarter-note tempo directly.
84
+ Decoded events include `sourceNoteIndex`, the zero-based head index within that page.
85
+ Persistent instruction labels require matching source identities and consistent note clocks;
86
+ older saved JSON without these identities keeps its prior omission of those labels.
87
+ Everything runs locally after installation; no account or server is required.
88
+
89
+ ### MP3 audio previews
90
+
91
+ To export it, install FFmpeg on PATH or the optional bundled encoder:
92
+
93
+ ```sh
94
+ python -m pip install ".[audio]"
95
+ sheet-interpreter score.pdf --output score.json --mp3 preview.mp3
96
+ ```
97
+
98
+ You can export MIDI and MP3 together. `--mp3-bitrate 192` sets the MP3 bitrate in
99
+ kbps (default 192); `--ffmpeg /path/to/ffmpeg` selects an encoder explicitly.
100
+ MP3 uses a basic built-in synthesized tone, not a realistic instrument soundfont.
101
+ It shares MIDI's tempo changes, ties, tremolo, supported guitar effects and repeat
102
+ navigation, including MIDI's current expressive limitations. Rendering is streamed
103
+ in bounded blocks and limited to one hour. No soundfont, inference rerun or network
104
+ is needed to export an already decoded document through the Python API.
105
+ FFmpeg is a separate optional dependency with its own license; it is not committed
106
+ or bundled in this repository's Apache-2.0 source/model artifacts.
107
+
108
+ ## Integration and model
109
+
110
+ Use `Interpreter` and `write_musicxml` from Python, or `SheetInterpreter.analyze()`
111
+ from Java. See [API examples and output format](docs/integration.md).
112
+ An optional [native Java decoding service](docs/native-decoder.md) supports
113
+ bounded, source-matched geometry and analysis requests from local workers.
114
+ The Python reader runs bundled-model OCR automatically on images and scanned PDFs.
115
+ The separate [shared Java OCR pipeline](docs/portable-ocr.md) and optional ONNX
116
+ binding remain available for cross-platform evaluation. The optional
117
+ [desktop ONNX segmentation adapter](docs/portable-segmentation.md) uses the pinned
118
+ v3 conversion without changing the default Python model.
119
+
120
+ The bundled v4 model comes from our own synthetic training lineage, without pretrained
121
+ weights or commercial score scans. See the [model card](models/MODEL_CARD.md), [evaluation](models/evaluation.json),
122
+ [training guide](training/README.md) and [source origins](docs/source-provenance.md).
123
+
124
+ ## Development
125
+
126
+ ```sh
127
+ python scripts/build_java.py
128
+ python scripts/test_java.py
129
+ python -m unittest discover -s tests
130
+ python scripts/smoke_test.py
131
+ ```
132
+
133
+ Use `python scripts/test_java.py --jobs 4` in place of the serial Java test
134
+ command to run every class once across four isolated JVMs. Each parallel JVM
135
+ defaults to a 512 MiB heap; per-batch logs and results are saved under
136
+ `build/test-parallel`. A failed batch makes the command fail.
137
+
138
+ Bug reports and contributions are welcome. Use shareable examples and keep private logs
139
+ and commercial scores out of public posts. See [CONTRIBUTING.md](CONTRIBUTING.md).
140
+
141
+ ### Pickup caller integration regression
142
+
143
+ After building the Java core, run the original numeric/content cases against the
144
+ actual standalone pickup call:
145
+
146
+ ```sh
147
+ python scripts/check_pickup_ingress.py --public . --classpath src/sheet_interpreter/interpreter.jar --out build/pickup-ingress
148
+ ```
149
+
150
+ Use a new output directory on each run. Maintainers can add `--app <app-worktree>`
151
+ and use its matching core classpath to check the exact Android and native caller
152
+ expressions too. This compiles source slices with current helper sources; it does
153
+ not run Android, image recognition or a packaged worker. The fixtures contain no
154
+ score images or private data.
@@ -0,0 +1,64 @@
1
+ score_reader-0.1.5.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
2
+ score_reader-0.1.5.dist-info/licenses/NOTICE,sha256=iBczM76jW8IGtLQrhxRu_4UcPV9NEJOmBEorxP4kLC4,565
3
+ sheet_interpreter/__init__.py,sha256=9XBPBp0Gbi0lo-m6aq6EtNksi5fHLNcuRri7tOZN7EM,333
4
+ sheet_interpreter/arpeggio_notation.py,sha256=TYJ3m-2TDHsHNQZtFaJ8GfyVKWJZI0SrTKB7zM8KcjE,5126
5
+ sheet_interpreter/articulation_export.py,sha256=P8TrlrMXmNrCSrsMxzlFC-oFwl7qLre4p5GlRtVWuwI,1895
6
+ sheet_interpreter/audio.py,sha256=8aHKCVuNk8s4aaTonZUCshvoVWmZWYcF9fm1PsOWdTE,12430
7
+ sheet_interpreter/beam_source.py,sha256=qfTXsnr1IKuGPiTCReEIyaIuFnkrFSSeSP1GorsHS10,7155
8
+ sheet_interpreter/boundary_ties.py,sha256=1AmyARgx_AVhU45Oh8toJvUyzYM7H1rU0rU-QH-CyUE,3970
9
+ sheet_interpreter/bow_export.py,sha256=YLzSzp9sLEdP9OMgN2_RykcBBePM9-C-UfqllPdpiI8,1631
10
+ sheet_interpreter/clef_export.py,sha256=ImQnGXADQ6kSnf_PN2ibuCIHsvyTOSV2bM9-5sgztpg,3191
11
+ sheet_interpreter/cli.py,sha256=1Aao8GUFjQVkOjtehJTDdC6Jvbz8UPjXeSEypk32w7U,7716
12
+ sheet_interpreter/clock_context.py,sha256=vrsfyL-adMH0Bs3oAoROHnZTVJv2QXOdsKYObhUSTdI,20068
13
+ sheet_interpreter/continuous_slide_curve.py,sha256=T86w0WNg8Q57qKav---ZL3ICVaKOW240oxB64H44dIY,3763
14
+ sheet_interpreter/cue_caption.py,sha256=8zcCBMyQSMmew2fhSBArjy9bKfKsTZldioSR44fPPws,2590
15
+ sheet_interpreter/dynamic_export.py,sha256=Vt_kjk8XBMB04HDQ3G5edbqzZ_7j1Lm8Vw5gbvgTdEs,4089
16
+ sheet_interpreter/fall_off_notation.py,sha256=8SGdtDsyo4J_gCMSmVQq_RgnWgJqSHbz3Sapt8hwVaU,5733
17
+ sheet_interpreter/grace_export.py,sha256=TZR270ZXcxKDQeEJz-3RUrjj079CP9114WHNZHW7uaM,4859
18
+ sheet_interpreter/guide_writer.py,sha256=Wlq1DKvJkEJ8i93trqtAN7EgYH9_auNnpgigIVEL9uU,15251
19
+ sheet_interpreter/guitar_effect.py,sha256=VCkfuzs7dCe_mymsW3TjOuuOMNpNnJRyCKq3OF37UWM,1261
20
+ sheet_interpreter/guitar_export.py,sha256=UD5R6l58MbqXQPnIneocMCpCdO4VET5w5StnK3mnjn0,1683
21
+ sheet_interpreter/hairpin_export.py,sha256=hiZHve4WfIIRpS3A0MgepUefS2xcMYIqi_u1TTtL7zQ,5364
22
+ sheet_interpreter/interpreter.jar,sha256=kQ0Pr5O1PKx3v0WQOj0BTppmcwl0v8DvSuRjbBiV0Nw,4119914
23
+ sheet_interpreter/midi.py,sha256=10jxpsYJhUhr4agGHtBGlBLv05cgf8le5b5G6zhQrAs,18790
24
+ sheet_interpreter/multi_rest_wire.py,sha256=k1G5Da9wv837PBJxTQvySWJjCxBlExQHjuQ59d4Fz5Q,3215
25
+ sheet_interpreter/musicxml.py,sha256=IhYb1BEjmSpSKBBgZ3j5XcXe8zzBeNePLZGdC9a4scw,55899
26
+ sheet_interpreter/natural_harmonic_notation.py,sha256=Tumamhb-ioUqp_xyOYiKvmX4GsFMY7u_A4AGZYSW460,5560
27
+ sheet_interpreter/navigation.py,sha256=nIVNoEGd-wAubAYtdQ9REzBOLbmCoeF-wMXziTy16I8,10364
28
+ sheet_interpreter/neutral_rest_caption.py,sha256=BvyOkS4_3dNkcl4kZW94K7jmB-ld_RZ2D_b9IAPKYHk,2639
29
+ sheet_interpreter/ocr.py,sha256=Cp2v_JreluQoKEAv6Kg8Cc28dFPMyrDqozYsCokn7y8,4434
30
+ sheet_interpreter/octave_shift_export.py,sha256=Z9StMUHHaIEOSroQSyYEuKLf6Pze-WWOxv3Al9W2sY8,4391
31
+ sheet_interpreter/ornament_export.py,sha256=JidSYtqT5PYSoAOX2vnvQrPZgHzWmiCmXT8PtvyGXho,2256
32
+ sheet_interpreter/page_processing_budget.py,sha256=MGxkYACM18FFBGeVMQ2xq6iSWwq_oliykn-k6Iu2oPY,810
33
+ sheet_interpreter/parenthesized_note_group.py,sha256=KKvp7XD8jcFIqlCzNv9bq8MQ7HGgMoYbR9OLSQfQALE,8246
34
+ sheet_interpreter/pdf_annotations.py,sha256=QBi5yBDWuvdmIo7arOby_seecYLChON-P8Cwk-z_wS4,2764
35
+ sheet_interpreter/performance.py,sha256=YzucECOZ8Rb960bN7-82GBdkH6yH_RUHdiPxOvK81hE,27991
36
+ sheet_interpreter/printed_tempo_spans.py,sha256=QA_1LwJ--Agd585p037PYo08Lmgb6ypV1yWkWJW1x5o,6147
37
+ sheet_interpreter/reader.py,sha256=6F39m3aFjFEriVnV65cbdTO9AB6xdJb7ib3wbEzSoYk,10538
38
+ sheet_interpreter/rest_kinds.py,sha256=2QLiDEJ_N4k90wE09eazAGExB_IcAjGn4ovIcSSof3U,1660
39
+ sheet_interpreter/runtime.py,sha256=b_T_TxN7oDCASa2E53fHmfWFRWf1bEZwEGUUxt-5RxA,572
40
+ sheet_interpreter/semantic_wire.py,sha256=k4POwI1AMK7qMdImQKBYuFUQ-spvC1gFhYHbmv_aAlc,15889
41
+ sheet_interpreter/slide_numbering.py,sha256=b2bKUO2-7LmvHDHQs5vR6zv2X7OZr8ks6Z78cm2UTdo,1943
42
+ sheet_interpreter/slide_performance.py,sha256=bxU9P28ofn2jHIsmzZdcb0ADFmINnDg0c1oNz9x9bPg,10151
43
+ sheet_interpreter/slur_export.py,sha256=hsxN6zWrBWz6hyL_Jdkm1Z3kbyGjPNackuvQRtCGWhU,6697
44
+ sheet_interpreter/slur_wire.py,sha256=XrCUzZ_AsEYzuYUVwkt8t-5E2Yt8hXDqBB-W4rzaGy0,7786
45
+ sheet_interpreter/source_tempo_clock.py,sha256=wDG_DmptEUegiBP-S8PZ5lko7LeTYWRoqa2crQ_5Vrc,4364
46
+ sheet_interpreter/spelling_export.py,sha256=N-Qcu3v91zixw8aHbrjoOzF97KsSmMZY89jwifPLGpU,2203
47
+ sheet_interpreter/straight_slide.py,sha256=APqEyyB3RH8VV3GRA_l8MeMM6ikGa5IpXBDOMtmWrRY,4285
48
+ sheet_interpreter/sudden_dynamic.py,sha256=atB4Q27Yi-tTcA9coL4rgfd6JXO67rq7KzKaCOdB5MA,2497
49
+ sheet_interpreter/technique_export.py,sha256=rr_zAm84VydtFSATM8PzktbdMOFaZb0jahp2tpDZwOE,3518
50
+ sheet_interpreter/tie_owners.py,sha256=W1uIGUpKlQma_eL2UGDwph_c299QlEj1Hfv777HswDk,1930
51
+ sheet_interpreter/tremolo_export.py,sha256=pf2rh68sQ2sS1NADedjNRap84UiSAASK8H0A85E8Bd0,5778
52
+ sheet_interpreter/tremolo_performance.py,sha256=5vKgWK4F75z-NvuUgAiRP-nPsa8vyKYUPiMWRn2c8KQ,2183
53
+ sheet_interpreter/tremolo_wire.py,sha256=yPqywCL4UIBheu1vrFpc3yNXuj43AsQcLX0G2WaEIWY,6986
54
+ sheet_interpreter/typed_events.py,sha256=VRW0J-XXgvzWHhAGDDpqCTAiytipBh-1X63nVxMPpn4,3034
55
+ sheet_interpreter/typed_performance.py,sha256=Rsxh64FcV2bREZbYY08I2KRXjdkAZIH0T8GZ5TXxsSQ,2653
56
+ sheet_interpreter/visual_size.py,sha256=aoanB9S6yMdwVsLcB1IX0F8HV4pZwUyrJanpZn4zDWA,867
57
+ sheet_interpreter/data/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
58
+ sheet_interpreter/data/NOTICE,sha256=iBczM76jW8IGtLQrhxRu_4UcPV9NEJOmBEorxP4kLC4,565
59
+ sheet_interpreter/data/music_sheets_v4_float16.tflite,sha256=kqt8NMJ8twTZXwzeJHs2EdFWP98cEUufmBersYp7apM,3907460
60
+ score_reader-0.1.5.dist-info/METADATA,sha256=gwwP6RUyLHWlbb3NwUxm-66DTGBTg2Zdt4RwCcaupEI,7810
61
+ score_reader-0.1.5.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
62
+ score_reader-0.1.5.dist-info/entry_points.txt,sha256=y8DT7wHVQoZk7G9Xdk-P_sOAUt-dVOCh58zh_WiOfOU,65
63
+ score_reader-0.1.5.dist-info/top_level.txt,sha256=TXj_VeG874CuowD58aRZisSw1uFQsbgb9PNtU3dOdus,18
64
+ score_reader-0.1.5.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ sheet-interpreter = sheet_interpreter.cli:main
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,13 @@
1
+ Music Sheets Interpreter
2
+ Copyright 2026 Luckolite
3
+
4
+ The original source code, documentation, generated examples and model weights
5
+ in this repository are offered under the Apache License, Version 2.0.
6
+
7
+ Training font files and the bundled Bravura/Leland recognition glyph rasters,
8
+ with their accompanying notices, retain the SIL Open Font License 1.1.
9
+ External runtime and training dependencies retain
10
+ their own licenses; see THIRD_PARTY_NOTICES.md.
11
+
12
+ This project is not affiliated with or endorsed by HOMR, Andromr, oemer,
13
+ Verovio, or the Apache Software Foundation.
@@ -0,0 +1 @@
1
+ sheet_interpreter
@@ -0,0 +1,9 @@
1
+ # Copyright 2026 Luckolite
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """Offline OMR. The inference runtime is imported only when an Interpreter is created."""
4
+ from .reader import Interpreter
5
+ from .musicxml import write_musicxml
6
+ from .audio import write_mp3
7
+
8
+ __version__ = "0.1.5"
9
+ __all__ = ["Interpreter", "write_musicxml", "write_mp3"]
@@ -0,0 +1,111 @@
1
+ # Copyright 2026 Luckolite
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """Complete source-owned arpeggio columns; notation only, without performed spread."""
4
+ import math
5
+ import re
6
+ import struct
7
+
8
+ PREFIX = 'arpeggio-column-v1:'
9
+ SOURCE = 'printed-arpeggio-wave'
10
+
11
+
12
+ def _int(text):
13
+ if not re.fullmatch(r'[+-]?[0-9]+', text):
14
+ raise ValueError('Not a Java integer')
15
+ value = int(text)
16
+ if not -2147483648 <= value <= 2147483647:
17
+ raise ValueError('Integer outside Java range')
18
+ return value
19
+
20
+
21
+ def _float32(value):
22
+ return struct.unpack('>f', struct.pack('>f', value))[0]
23
+
24
+
25
+ def target_indices(expression, page):
26
+ """Mirror ScoreArpeggioNotation.targetIndices, never a nearest-head heuristic."""
27
+ if (expression.get('kind') != 'ARPEGGIO'
28
+ or type(expression.get('staffIndex')) is not int
29
+ or type(expression.get('staffCount')) is not int):
30
+ return []
31
+ target = expression.get('targetEventId') or ''
32
+ if not isinstance(target, str) or not target.startswith(PREFIX):
33
+ return []
34
+ try:
35
+ fields = target[len(PREFIX):].split(':')
36
+ if len(fields) != 5:
37
+ return []
38
+ measure, staff, count = map(_int, fields[:3])
39
+ # The producer serializes Float.toHexString, not expression-column float bits.
40
+ if not re.fullmatch(r'[+-]?0[xX][0-9a-fA-F]+(?:\.[0-9a-fA-F]*)?[pP][+-]?[0-9]+', fields[3]):
41
+ return []
42
+ position = _float32(float.fromhex(fields[3]))
43
+ measures = page.get('score', {}).get('measures', [])
44
+ if (measure < 0 or measure >= len(measures) or not math.isfinite(position)
45
+ or not 0 <= position <= 1 or staff != expression.get('staffIndex')
46
+ or count != expression.get('staffCount')):
47
+ return []
48
+ steps = [_int(text) for text in fields[4].split(',')]
49
+ if len(steps) < 2 or len(set(steps)) != len(steps):
50
+ return []
51
+ if not any(e.get('sourceId') == SOURCE and e.get('staffIndex') == staff
52
+ and e.get('staffCount') == count for e in expression.get('evidence', [])):
53
+ return []
54
+ found, result = set(), []
55
+ for index, note in enumerate(page.get('score', {}).get('notes', [])):
56
+ if (note.get('kind', 'PITCHED') == 'PITCHED' and not note.get('articulations', 0) & 32768
57
+ and note.get('measureIndex') == measure and note.get('staffIndex') == staff
58
+ and note.get('staffCount') == count
59
+ and abs(_float32(_float32(note['positionInMeasure']) - position)) <= _float32(.018)):
60
+ step = note['staffStep']
61
+ if type(step) is not int or step in found:
62
+ return []
63
+ found.add(step)
64
+ result.append(index)
65
+ return result if found == set(steps) else []
66
+ except (ValueError, TypeError, KeyError, OverflowError, struct.error):
67
+ return []
68
+
69
+
70
+ def _computed_offset(offset, length, begin):
71
+ """Mirror ScoreAnchor.computedOffset for decoder-computed musical time only."""
72
+ if not math.isfinite(offset) or offset < 0:
73
+ return offset
74
+ rounding = 4 * math.ulp(max(length, abs(begin + length)))
75
+ return length if offset > length and offset - length <= rounding else offset
76
+
77
+
78
+ def plan(expression, page, available=None):
79
+ """Return all heads with complete available, nonfallback decoder-proven written time."""
80
+ indices = target_indices(expression, page)
81
+ notes, events = page.get('score', {}).get('notes', []), page.get('events', [])
82
+ if not indices or len(notes) != len(events):
83
+ return []
84
+ allowed = set(range(len(events))) if available is None else set(available)
85
+ if not allowed.issuperset(indices):
86
+ return []
87
+ measure = notes[indices[0]]['measureIndex']
88
+ beats = page.get('measureBeats', [])
89
+ if (not isinstance(beats, (list, tuple)) or measure >= len(beats)
90
+ or any(type(b) not in (int, float) or not math.isfinite(b) or b <= 0
91
+ for b in beats[:measure+1])):
92
+ return []
93
+ begin, length = sum(beats[:measure]), beats[measure]
94
+ onset = None
95
+ for index in indices:
96
+ event, note = events[index], notes[index]
97
+ start, duration = event.get('startBeat'), event.get('durationBeats')
98
+ if (event.get('kind', 'PITCHED') != 'PITCHED' or event.get('durationFallback', False)
99
+ or event.get('grace', False)
100
+ or type(event.get('sourceNoteIndex', index)) is not int
101
+ or event.get('sourceNoteIndex', index) != index
102
+ or event.get('measureIndex') != note['measureIndex']
103
+ or event.get('staffIndex') != note['staffIndex']
104
+ or event.get('staffCount') != note['staffCount']
105
+ or any(type(v) not in (int, float) or not math.isfinite(v) for v in (start, duration))
106
+ or duration <= 0 or start < begin
107
+ or _computed_offset(start + duration - begin, length, begin) > length
108
+ or onset is not None and abs(start-onset) > 1e-7):
109
+ return []
110
+ onset = start
111
+ return indices
@@ -0,0 +1,49 @@
1
+ # Copyright 2026 Luckolite
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ """Retain basic source marks without interpreting ornament or guitar-effect bits."""
4
+ import xml.etree.ElementTree as ET
5
+
6
+ SYMBOLS = ((1, 'accent'), (2, 'strong-accent'), (4, 'staccato'),
7
+ (8, 'tenuto'), (16, 'staccatissimo'))
8
+ MASK = 31
9
+
10
+
11
+ def source_flags(page, index):
12
+ # Main emits one event per raw head, in the same order. Edited or partial
13
+ # event lists cannot borrow marks from a different source slot.
14
+ events = page['events']
15
+ notes = page.get('score', {}).get('notes', [])
16
+ if len(notes) != len(events):
17
+ return 0
18
+ event, source = events[index], notes[index]
19
+ fields = ('measureIndex', 'staffIndex', 'staffCount')
20
+ if (type(event.get('sourceNoteIndex', index)) is not int
21
+ or event.get('sourceNoteIndex', index) != index
22
+ or any(key not in event or key not in source or event[key] != source[key] for key in fields)):
23
+ return 0
24
+ flags = source.get('articulations', 0)
25
+ if type(flags) is not int or not 0 <= flags <= 0x7fffffff:
26
+ raise ValueError('Invalid retained articulation flags')
27
+ return flags
28
+
29
+
30
+ def retained(page, index):
31
+ return source_flags(page, index) & MASK
32
+
33
+
34
+ def chord_marks(chord, start):
35
+ """Common shared-stem glyphs appear once; differing head marks survive."""
36
+ flags = [n.get('retainedArticulations', 0) if start == n['start'] else 0 for n in chord]
37
+ common = MASK
38
+ for value in flags:
39
+ common &= value
40
+ return [value if i == 0 else value & ~common for i, value in enumerate(flags)]
41
+
42
+
43
+ def write(notation, flags):
44
+ articulations = notation.find('articulations')
45
+ if articulations is None:
46
+ articulations = ET.SubElement(notation, 'articulations')
47
+ for bit, tag in SYMBOLS:
48
+ if flags & bit:
49
+ ET.SubElement(articulations, tag, {'type': 'up'} if bit == 2 else {})