Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update instruments.xml to add families and improve sorting #8431

Merged
merged 1 commit into from
Jul 12, 2021

Conversation

shoogle
Copy link
Contributor

@shoogle shoogle commented Jun 25, 2021

Run share/instruments/update_instruments_xml.py to fetch the latest version of the online spreadsheet. In this version, every instrument has been assigned a family. Also, instruments are now sorted based on their group, family and minimum professional pitch, among other things. This ensures they appear roughly in score order according to standard orchestral layout. Finally, descriptions have been improved and a few small fixed made to fix incorrect or missing data.

In addition, some compatibility code was changed to improve instrument recognition in older MSCX score files that lack the appropriate MuseScore or MusicXML instrument IDs. The old code returned the first instrument that matched a given criteria (e.g. same trackName), whereas the new code returns the instrument that gives the best match according to multiple criteria. This means the return value is less dependent on the order in which instruments are defined within instruments.xml.

Comment on lines 166 to +176
to_subelement(el, instrument, 'trackName')
to_subelement(el, instrument, 'longName')
to_subelement(el, instrument, 'shortName')
to_subelement(el, instrument, 'init')
# if instrument["ddName"] != '[hide]':
# to_subelement(el, instrument, 'trackName')
# to_subelement(el, instrument, 'longName')
# to_subelement(el, instrument, 'shortName')
# if instrument["ddName"]:
# dd_el = ET.SubElement(el, 'dropdownName')
# dd_el.text = instrument["ddName"]
# to_attribute(dd_el, instrument, 'ddMeaning', 'meaning')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RomanPudashkin, once this is merged, you can uncomment these 8 lines and delete the 3 lines immediately above (that set trackName, longName and shortName before the if statement), then rerun the script to generate the new style of instruments.xml that you will need to fix the dropdown in the New Score Wizard. It will fetch some new data from the online spreadsheet as well as adding the <dropdownName> element.

@njvdberg
Copy link
Contributor

@RomanPudashkin Score Ordering uses the order of instruments in instruments.xml to find the order of the instruments in the same family. Is this taken into account with this PR? This might a possible cause of incompatibility with existing scores. Since families can be overwritten in score orders, it is not enough to keep the order of instruments within the families intact. This has to be checked with existing score orders in orders.xml as well in the templates in share/templates.

@shoogle
Copy link
Contributor Author

shoogle commented Jun 27, 2021

@njvdberg, the new ordering system has been devised by myself and @oktophonie. We know that changing the order of instruments in instruments.xml will affect score ordering for instruments within a family. That much is intensional, but we would be interested to learn about other problems that we may not have foreseen, or places where you think our new ordering (which you can see in the online spreadsheet) is incorrect.

New scores vs. old scores

We want new scores created in MuseScore 4 to use our new ordering, but we want old scores created in MuseScore 3 to display in MuseScore 4 just as they did in MuseScore 3. When you open an old file the ordering should be unchanged, but if you try to add or remove instruments then things could start to move around. Possible solutions are:

  1. Do nothing and accept that adding instruments will cause the order to change (hopefully not by much).
  2. Lock the instruments dialog for imported scores until the user opts-in to the new ordering system.
  3. Create a new custom ordering for imported scores. Newly added instruments must be placed manually.

Algorithmic sorting

If all else fails then we may consider reverting to the previous ordering of instruments.xml, but the old ordering was done manually and we would prefer to order instruments based on an algorithm if possible as this will make it easier to add new instruments in the future. I will explain how the algorithm works in a future build review.

We don't think our algorithm has changed the relative order of any popular combinations of instruments, except perhaps for the unpitched percussion instruments (which have no "correct" ordering anyway). If people have used some of the more exotic instruments then they may find they are ordered differently to before, but the ordering for the vast majority of scores should not have changed.

@njvdberg
Copy link
Contributor

I had a quick check on the differences between the old and new instruments.xml and see a few possible conflicts but this mainly concerns "exotic" instruments which I guess won't be used with score ordering in the first place. So for the "common" instruments I don't expect any issues. Maybe except for unsorted woodwinds because the complete saxophone section is moved above the bassoon. But on the other hand, it was unsorted already.

Also, in MU4 score ordering I made a small change compared to MU3. When opening the instruments form the existing order of the instruments is checked against the specified score order. If it doesn't match, the score order is change to <score order> (customized) and the "wrong" order is kept as it is (at least that's the intention 😃).

@shoogle shoogle force-pushed the instrument-spreadsheet branch 3 times, most recently from 5784948 to 11e1fbb Compare July 2, 2021 04:21
@shoogle shoogle marked this pull request as ready for review July 2, 2021 04:48
@shoogle
Copy link
Contributor Author

shoogle commented Jul 2, 2021

@njvdberg, please take a look at my changes to instrtemplate.cpp and instrument.cpp and let me know what you think.

@shoogle shoogle force-pushed the instrument-spreadsheet branch 2 times, most recently from 7e256d5 to b83a98a Compare July 8, 2021 01:20
@shoogle shoogle marked this pull request as draft July 8, 2021 15:08
Run share/instruments/update_instruments_xml.py to fetch the latest
version of the online spreadsheet. In this version, every instrument
has been assigned a family. Also, instruments are now sorted based on
their group, family and minimum professional pitch, among other things.
This ensures they appear roughly in score order according to standard
orchestral layout. Finally, descriptions have been improved and a few
small fixed made to fix incorrect or missing data.

In addition, some compatibility code was changed to improve instrument
recognition in older MSCX score files that lack the appropriate
MuseScore or MusicXML instrument IDs. The old code returned the *first*
instrument that matched a given criteria (e.g. same trackName), whereas
the new code returns the instrument that gives the *best* match
according to multiple criteria. This means the return value is less
dependent on the order in which instruments are defined within
instruments.xml.
@shoogle shoogle force-pushed the instrument-spreadsheet branch from b83a98a to 28fa244 Compare July 8, 2021 15:14
@shoogle shoogle marked this pull request as ready for review July 8, 2021 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants