Can slurs automatically be converted to ties?

• Jun 4, 2019 - 14:43

The leader of our music group gives me scores in MusicXML format but all ties are slurs. I can't tell if that's just because of the package he uses or the conversion via XML. However....

I end up finding each slur that joins note of the same pitch, deleting it and inserting a tie. I have to do that for each part in the score. And then when I am sent versions 2, 3, 4.... I have to do it all again.

Given the fact that it's not easy for me to change the way I am sent the scores, I'm wondering if there is a way of doing this in MuseScore. Or at least making the job less painful.

(I imagine some kind of find/replace but it would have to recognise slurs between notes of the same pitch otherwise inserting a tie will change the second pitch. Or maybe a plugin).


There is no easy way to do this from within the program. It would be much easier if you used a zip program, extracted the .mscx file and used a text editor that allowed you to do a find and replace. FYI, the .mscz file is just a .zip file that has had the extension changed so MuseScore knows there is a song in it. The .mscx file in the archive is the actual song.

In reply to by mike320

That's interesting; I didn't realise the compressed file as a ZIP archive. Looks like the effort to do it in a text editor is not trivial though. For example just swapping all occurences of "Slur" to "Tie" didn't work (without the complication of working out if the pitches are the same) as the structure of the XML is slightly different. I could write a script to do it I guess but only if I can get the text substitution to work.

In reply to by TheOnlyMagicbean

I thought about the complications like you do want to keep some slurs, but I was being broad in my explanation until you replied. I'm not intimately familiar with the internal works of the .mscx file so I'm not positive what might clue you in that a tie would be more appropriate. I understand that the length of the tie is indicated, but you would then have to iterate through the notes until you decide if the slur was appropriate or if it should have been a tie.

One other option I thought of was using a plugin. I don't know if this is a viable option since I don't know if you have the ability to delete slurs and add ties. If this is possible it would be easier than working with the .mscx file.

Perhaps someone who has done some MuseScore programming could jump in and give some advice.

Hey there - turns out I ended up in a situation where I wanted to do this too (I believe you're right that it's an artifact of MusicXML conversion). At this point it is possible to do a naive job of it using the MuseScore 3 plugin framework, so...

I wrote a quick plugin for it! The plugin is attached.

Keep in mind this is only intended for single-note melody lines. I will almost certainly not work with tied chords.

Attachment Size
remove_slurs.qml 1.77 KB

In reply to by kwertyops

Very cool!

To be clear: MusicXML is perfectly capable of separating slurs and ties, and MuseScore understands this distinction correctly both when importing and when exporting. However, it's certainly possible that the program that was used to create the MusicXML erroneously uses for slurs for ties, or the person using that program might have made that mistake.

In reply to by Marc Sabatella

Yes, thank you for clarifying.

My situation of slur/tie confusion (and I assume the original poster's) was a result of conversions from unreliable original sources, not due to a limitation in MusicXML or in MuseScore. Nevertheless, this plugin should help if you have a lot of scores with the same problem, as I did.

In reply to by kwertyops

I know the problem and appreciate a solution. So I've installed the plugin to release candidate and wrote a test file with a slur to convert and a tie to leave untouched.
Sadly I must have done something wrong. The plugin did not change anything. So I changed the code to get the debug output that you changed into commentary and got the follwing output:

Plugin Details:
Menu Path: Plugins.Remove Slurs (leave ties)
Version: 3.0
Description: This plugin removes slurs while leaving ties
Requires Score
Debug: Ms::PluginAPI::Chord(0x17e7fad0), 92
Debug: Ms::PluginAPI::Note(0x17e80220)
Debug: Ms::PluginAPI::Chord(0x17e7ff20), 92
Debug: Ms::PluginAPI::Note(0x17e80070)
Debug: Ms::PluginAPI::DurationElement(0x17e801f0), 24
Debug: Ms::PluginAPI::DurationElement(0x17e80d30), 24
Debug: Ms::PluginAPI::Chord(0x17e804f0), 92
Debug: Ms::PluginAPI::Note(0x17e80700)
Debug: Ms::PluginAPI::Chord(0x17e811e0), 92
Debug: Ms::PluginAPI::Note(0x17e80f40)
Debug: Ms::PluginAPI::DurationElement(0x17e818a0), 24
Debug: Ms::PluginAPI::DurationElement(0x17e81060), 24
Debug: Ms::PluginAPI::DurationElement(0x17e81570), 24

Please can you assist, what I have to change to get the desired result?

OS: Windows 10 (10.0), Arch.: x86_64, MuseScore version (64-bit):, revision: fb3c202

Attachment Size
removeSlur.mscz 4.11 KB
test.JPG 18.86 KB

In reply to by SlyDr

Aha, my apologies - apparently I misinterpreted the problem that the original poster had.

What I had in my files were ties that were intended to be slurs, and appeared to be slurs. I wanted to remove the "slur-looking" ties, leaving only the valid ties.

What you have here are slurs that are intended to be ties. You want to replace the "tie-looking" slurs with real ties. Unfortunately, I think the previous poster was correct that the current plugin framework cannot handle this. I have no way of "finding" the slur elements in a score to check their validity, I only have a way that I have of "finding" tie elements to check their validity.

I've tried to think of a way of solving your problem with the tools available, but couldn't come up with anything. I would edit my original post with this correction if I could!

Do you still have an unanswered question? Please log in first to post your question.