Possible to convert Staff Text to left hand fingerings?
Within MuseScore is there a way to convert Staff Text to guitar left hand fingerings?
I've got lots XML files where fingerings were added (or exported) as a Text object containing the number 0, 1, 2 ,3, or 4.
I tried editing a .mscx file by search and replace:
But this provoked a Cannot read file; bad format alert.
Comments
From looking at the Cello fingering plugin I gather that fingering is done with Staff Text, but I'm no fingering expert...
EDIT: Do you actually see "Fingering" in a .mscx file where you added LH Guitar Fingerings yourself?
In reply to From looking at the Cello… by elsewhere
elsewhere wrote > From looking at the Cello fingering plugin I gather that fingering is done with Staff Text
I've not used the Cello fingering plugin, so I can't comment on it specifically. But as I understand it, Staff Text is not the proper object for fingerings. And that's exactly the problem I'm trying to solve when I encounter "fingerings" in Staff Text —from imported MusicXML. I need to convert hundreds of Staff Text "numbers" to Fingering objects (where each fingering has the same number as the Staff Text it will replace.)
elsewhere wrote > Do you actually see "Fingering" in a .mscx file where you added LH Guitar Fingerings yourself?
Yes, as shown in the initial post and here (This mxcx was generated from MS 3.6.2 where the source Guitar score had a single A note and a single "1" Fingering:
scorster
In reply to > From looking at the Cello… by scorster
The Cello plugin steered me wrong indeed.
I found an interesting (MU2.x!!) plugin
https://musescore.org/nl/project/fingering-positioner
that has
if (noteElements[j].type === Element.FINGERING) {
with
var noteElements = note.elements
and it puts the fingering inside the note.
I don’t know if you dabble in plugins. If not, I can try my hands at it. You mention that you posted a sample .xml file, but I don’t see any attachment.
EDIT: Also an interesting discussion at https://musescore.org/en/node/142436
EDIT2: Here is a MU3.x plugin prototype and a test file Is this what you mean?
Staff2Finger.qml
fingertest.mscz
In reply to The Cello plugin steered me… by elsewhere
@elsewhere
re: EDIT2: Here is a MU3.x plugin prototype and a test file Is this what you mean?
• Staff2Finger.qml
• fingertest.mscz
This is fantastic! Thanks so much!!
I did a simple test to see if the plugin would ignore "normal" text. Best I can tell, it intelligently operates only on single-digit Staff Text numerics with a text value of 0 to 5. Which is perfect. This means that people can use it without wiping out other important Staff Text objects. (I looked at the code but didn't quite follow the logic. Will check again later.)
The plugin will save me LOTS of tedium because I have hundreds of scores with LOTS of fingerings in Text objects. Amazing that the plugin has existed since MS2. Did you alter it at all?
scorster
In reply to re: EDIT2: Here is a MU3.x… by scorster
I concocted the plugin from various existing ones.
The logic is as follows:
1. Collect all notes
2. Colect all StaffText
3. ‘Blindly’ turn stafftext x into fingering on note x
This implies that:
1. There is a stafftext for every note
2. There are no other stafftext. Other text like system texts are OK
Stafftexts are just copied, so they can be anything; not only 0-5. To limit it to 0-5 should be possible: I collect the ticks for both notes and stafftext, so I can match them up that way (but this is not done yet)
I experimented with chords, and that works, but depending on the position of the stafftext (above/below) the assignment to the notes can be wrong (i.e in reverse order). To fix that just change abovbe/below of the stafftext.
Multiple staves don’t work right: notes are collected staff by staff, stafftext segment by segment (over all staffs), but selecting one staff at a time should work (not tested yet).
Let me know what problems you encounter, what enhancements you desire.
In reply to I concocted the plugin from… by elsewhere
re: [the plugin ]‘Blindly’ turns stafftext x into fingering on note x
Ah ... no wonder I failed to find an exclusory algorithm. There isn't one.
And the reason I thought there was? In my tests I simply added StaffText objects to the notes in your example score. In other words, adding them resulted in some notes having two Staff Text objects. And apparently the plugin only processes the first found Staff Text per note.
Let me know what problems you encounter, what enhancements you desire.
Seems logical to me that the Text2Fingering plugin would only process a Staff Text if its text value is a single char in the range of chars 0 thru 5. Then there's no collateral damage ... unless the score has a few Staff Text objects with values 1, 2, 3, 4 or 5 that should not be converted. But that will not be a problem for me!
Please see this test score: StaffText2Fingering Test 02.mscz
Thanks again!
scorster
In reply to re: [the plugin ]‘Blindly’… by scorster
The new plugin only collects legit stafftexts, but still expects an equal number of notes and legit stafftexts. I added a console.log warning to that effect.
Beware that the used stafftexts are set to “”’. The preferred removeElement works for single notes but causes problems in chords.
It is also possible to process more than 1 file at the time. See attached miniX.qml
I don’ think multiple staves will work. Just copy 1 staff at a time to a temp file.
I also add your processed test file
In reply to The new plugin only collects… by elsewhere
@elsewhere
Thanks for modifying StaffText 2Fingering plugin. I've tested in MuseScore 3.6 and 3.7. The plugin now operates only onStaff Text objects that contain text that's equivalent to a legitimate fingering (e.g. 1, 2, 3, 4 or 5) thereby ignoring other text that the user likely wants unmodified.
It works great for me now and hopefully for others who encounter scores where:
a) fingerings were mistakenly entered as Staff Text
b) fingering objects were strongly encoded as text in a musicXML export, and therefore imported as such.
Thanks again!
scorster
In reply to @elsewhere Thanks for… by scorster
I posted a new version at
https://musescore.org/en/project/convert-staff-text-fingerings
It no longer requires that every note has a legit stafftext & vice versa
In reply to I posted a new version at… by elsewhere
As mentioned above, I've found the StaffText2Fingerings plugin enormously helpful in MuseScore 3.6 and 3.7.
Have you tested the StaffText2Fingerings plugin in MuseScore 4.2.1?
It runs in 4.2.1, but oddly.
After running the plugin there's no apparent effect until I drag one of the objects (which all still look like Staff Text.) After dragging one then they all disappear. Undo does not restore them.
scorster
In reply to Have you tested the… by scorster
Thanks for the info. I'm not running MU4, so I cannot help with this MU4 problem.
In reply to Have you tested the… by scorster
In another thread I was reminded that MU4 plugin code needs a startCmd/endCmd wrapper. Could you please test the attached in MU4. If that works I can update the plugin to 4.x compatible.
The problem is staff texts are attached to staves and not [notes] where fingering texts are are attached to [notes]:
fingering:
staff text:
Unfortunately you'll need something more hardcore than a tag-name switch from stafftext to fingering,... or you could get crazy with scripting to some how move any staff text into the first note tag from the following chord tag. A plugin could probably create fingerings on the top notes of the same staff and then delete the staff-text, but even then it probably wouldn't have access to [voice-1-4] information. Could still give a usable result.
In reply to The problem is staff texts… by worldwideweary
@worldwideweary
Thank you. That explains it!
I'm not familiar with MuseScore's object model so you helped me by pointed out that:
• staff texts are attached to staves ... not [notes]
• fingering texts are are attached to [notes] fingering ... not staves
I suspected it would not be as easy as tag-name switch. Now I know.
Much appreciated!
scorster