johentsch / ms3

A parser for annotated MuseScore 3 files.
https://ms3.readthedocs.io
GNU General Public License v3.0
41 stars 3 forks source link

Low-level method for creating a score excerpt #90

Closed johentsch closed 1 year ago

johentsch commented 1 year ago

This PR addresses the base requirement for #89 which is the excerpt creation engine.

This is achieved by subclassing _MSCX_bs4, bringing forth an Excerpt class that uses its parents XML manipulation methods (especially .new_tag) to amend the beginning of the excerpt so that it displays the correct

and, if annotations are present but no label occurs on quarterbeat 0 of the excerpt, that it repeats the label in vigor at that moment. Furthermore, the new method .make_excerpt() comes with the arguments globalkey and localkey which allow for updating/completing this information for the first label.

One thing that is currently missing is the repetition of the tempo mark in vigor. A simple solution (rather than, say, finding the performance indication and printing it in parentheses) would be to use the tempo from the previous marking and simply include it as an invisible metronome mark.