-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
ERROR - Element beat-unit
#22974
Comments
It seems like this issue is occurring at the export stage. We can investigate it, but unfortunately it's not something we can prioritise as urgent at the moment. |
Doesn't crash for me, same OS, same MuseScore version, so I can only reproduce steps 1-6 At step 6 (close score just imported), do you save or not? (Doesn't make a difference to me, neither crashes) At step 2 (export to MusicXML): which options do you use? Asking because I get that import error on line 554 rather than 621, exporting with "Manually added system and page breaks only", your error shows when exporting with "All layout" (but it still doesn't crash for me then) Culprit XML: <direction-type>
<metronome parentheses="no" default-x="-37.68" default-y="33.73" relative-y="20.00">
<beat-unit></beat-unit>
<per-minute>160</per-minute>
</metronome>
</direction-type> Mu3 doesn't have that export issue BTW. Changing that |
Code got to be MuseScore/src/importexport/musicxml/internal/musicxml/exportxml.cpp Lines 4833 to 4846 in 60cbf53
and this: MuseScore/src/importexport/musicxml/internal/musicxml/exportxml.cpp Lines 4881 to 4890 in 60cbf53
both is pretty old code, no recent changes |
This might fix it: diff --git a/src/importexport/musicxml/internal/musicxml/exportxml.cpp b/src/importexport/musicxml/internal/musicxml/exportxml.cpp
index 020f5ca17e..75d4ca9375 100644
--- a/src/importexport/musicxml/internal/musicxml/exportxml.cpp
+++ b/src/importexport/musicxml/internal/musicxml/exportxml.cpp
@@ -4836,6 +4836,9 @@ static bool findMetronome(const std::list<TextFragment>& list,
static void beatUnit(XmlWriter& xml, const TDuration dur)
{
+ IF_ASSERT_FAILED(dur.isValid()) {
+ return;
+ }
int dots = dur.dots();
xml.tag("beat-unit", TConv::toXml(dur.type()));
while (dots > 0) { |
As might: diff --git a/src/importexport/musicxml/internal/musicxml/exportxml.cpp b/src/importexport/musicxml/internal/musicxml/exportxml.cpp
index 020f5ca17e..75d4ca9375 100644
--- a/src/importexport/musicxml/internal/musicxml/exportxml.cpp
+++ b/src/importexport/musicxml/internal/musicxml/exportxml.cpp
@@ -4880,8 +4883,6 @@ static void wordsMetronome(XmlWriter& xml, const MStyle& s, TextBase const* cons
xml.startElementRaw(tagName);
int len1 = 0;
TDuration dur;
- TempoText::findTempoDuration(metroLeft, len1, dur);
- beatUnit(xml, dur);
if (TempoText::findTempoDuration(metroRight, len1, dur) != -1) {
beatUnit(xml, dur); |
@Jojo-Schmitz, I just noticed the following. After the first restart of the system, I no longer observed such a crash. It's very strange. But I will change the issue description accordingly. Thanks for the comment.
And what can I do for my part to avoid such errors when exporting? What workarounds could you suggest? |
Short of manually correcting the XML or just ignoring that error there is no workaround |
@Jojo-Schmitz Your proposed solution would produce invalid MusicXML because once there is a |
I see. But code that potentially writes beat-unit twice (or once empty) seems wrong too |
beat-unit
" and crashbeat-unit
Had a quick look. Using current master (commit 77c1c94) no MusicXML metronome element is generated when exporting MusicXMLBug.mscz. I don't have 4.3 available and no time to investigate further right now. |
The root of the problem is that there is a No-Break Space (U+00A0) in the tempo marking, which throws the metronome detection completely off track. If you put a normal space in there it works just fine. So it should be quite easy to fix? |
@rettinghaus, thank you so much! Indeed, it helped. I can't even imagine where the non-breaking space could have come from (provided that I enter the tempo from the keyboard and always use a regular space). |
So No-Break Space should get added to the regular expression detecting tempo texts. Apparently Mu3 did better on this. |
@miiizen could you please take over? |
Issue type
Import/export issue
Bug description
The
mscz
file I attached below is exported with errors in the code. Because of this, Dorico freezes when trying to play the score.Steps to reproduce
MusicXML file error when importing to Dorico:
mscz
file21-15-52_compressed.mp4
MusicXMLBug.zip
Screenshots/Screen recordings
Dorico:
![Снимок экрана (368)](https://private-user-images.githubusercontent.com/134041121/334062743-c6f4b053-320c-451b-8e3f-5cabc022d91c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI1NDM5MzYsIm5iZiI6MTcyMjU0MzYzNiwicGF0aCI6Ii8xMzQwNDExMjEvMzM0MDYyNzQzLWM2ZjRiMDUzLTMyMGMtNDUxYi04ZTNmLTVjYWJjMDIyZDkxYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODAxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgwMVQyMDIwMzZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04NTk0YWU2MDRhODVjYzdjZDY1MmYyNzczYjYwOTBiZjQ1MTE0YzVhZWI3MGQ3YzBkZmJlN2FmYzFkN2I4ZGJlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.p0sE11g-IdipnUiBvgvyPuXgunyEm5yXGPXF0auC5UA)
MuseScore Studio 4:
![Снимок экрана (369)](https://private-user-images.githubusercontent.com/134041121/334061716-cd12465d-645d-4673-8cf0-8e3614f367ac.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI1NDM5MzYsIm5iZiI6MTcyMjU0MzYzNiwicGF0aCI6Ii8xMzQwNDExMjEvMzM0MDYxNzE2LWNkMTI0NjVkLTY0NWQtNDY3My04Y2YwLThlMzYxNGYzNjdhYy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwODAxJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDgwMVQyMDIwMzZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04MzBkOGEwODZmNGZhMWUyODJlYTIwMjYzNmFjOTdkNzExMTFhM2VkMjdhMDQxOTY4Y2I1Y2Y1MmU4Y2U3MGRmJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.8bu0M-UxVxaIFeuvyhGDVmVNYprXYHvURgzpTeRzQ6w)
MuseScore Version
MuseScore Studio version (64-bit): 4.3.0-241231433, revision: github-musescore-musescore-5f36e74
Regression
I don't know
Operating system
Windows 11
Additional context
I do not know if there has already been something like this on GitHub. This situation is happening so far only with the score I have attached.
Since I need to import a file to Dorico in a short time, I really ask the participants who understand issues of this kind to explain to me why this is happening. I will try to resort to some workarounds to avoid such errors.
The text was updated successfully, but these errors were encountered: