Skip to content

Commit

Permalink
Add more cases to finale dynamic inference
Browse files Browse the repository at this point in the history
Backport of musescore#23248
  • Loading branch information
miiizen authored and Jojo-Schmitz committed Jun 15, 2024
1 parent 00eb102 commit 386af37
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 1 deletion.
4 changes: 3 additions & 1 deletion importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3845,7 +3845,9 @@ void MusicXMLParserDirection::textToDynamic(QString& text) const
QString simplifiedText = MScoreTextToMXML::toPlainText(text).simplified();
// Correct finale's incorrect dynamic export
if (_pass1.exporterString().contains("finale")) {
static const std::map<QString, QString> finaleDynamicSubs = { { "π", "pp" }, { "P", "mp" }, { "F", "mf" }, { "ƒ", "ff" } };
static const std::map<QString, QString> finaleDynamicSubs
= { { "π", "pp" }, { "P", "mp" }, { "F", "mf" }, { "ƒ", "ff" }, { "Ï", "fff" },
{ "S", "sf" }, { "ß", "sfz" }, { "Z", "fz" }, { "Í", "fp" } };
for (const auto& sub : finaleDynamicSubs) {
if (simplifiedText == sub.first) {
simplifiedText = sub.second;
Expand Down
30 changes: 30 additions & 0 deletions mtest/musicxml/io/testFinaleDynamics.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@
<type>quarter</type>
<stem>down</stem>
</note>
<direction>
<direction-type>
<words default-y="-63" font-family="Scarlatti" font-size="14.4">Ï</words>
</direction-type>
<sound dynamics="36.67"/>
</direction>
<note default-x="151.73" default-y="-20">
<pitch>
<step>B</step>
Expand All @@ -149,6 +155,12 @@
<type>quarter</type>
<stem>down</stem>
</note>
<direction>
<direction-type>
<words default-y="-63" font-family="Scarlatti" font-size="14.4">S</words>
</direction-type>
<sound dynamics="36.67"/>
</direction>
<note default-x="294.77" default-y="-20">
<pitch>
<step>B</step>
Expand Down Expand Up @@ -177,6 +189,12 @@
<type>quarter</type>
<stem>down</stem>
</note>
<direction>
<direction-type>
<words default-y="-63" font-family="Scarlatti" font-size="14.4">ß</words>
</direction-type>
<sound dynamics="36.67"/>
</direction>
<note default-x="84.52" default-y="-20">
<pitch>
<step>B</step>
Expand All @@ -203,6 +221,12 @@
<type>quarter</type>
<stem>down</stem>
</note>
<direction>
<direction-type>
<words default-y="-63" font-family="Scarlatti" font-size="14.4">Z</words>
</direction-type>
<sound dynamics="36.67"/>
</direction>
<note default-x="227.55" default-y="-20">
<pitch>
<step>B</step>
Expand Down Expand Up @@ -231,6 +255,12 @@
<type>quarter</type>
<stem>down</stem>
</note>
<direction>
<direction-type>
<words default-y="-63" font-family="Scarlatti" font-size="14.4">Í</words>
</direction-type>
<sound dynamics="36.67"/>
</direction>
<note default-x="84.52" default-y="-20">
<pitch>
<step>B</step>
Expand Down
31 changes: 31 additions & 0 deletions mtest/musicxml/io/testFinaleDynamics_ref.mscx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
<Dynamic>
<subtype>pp</subtype>
<velocity>33</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
Expand All @@ -160,6 +161,11 @@
<tpc>19</tpc>
</Note>
</Chord>
<Dynamic>
<subtype>fff</subtype>
<velocity>33</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
<StemDirection>down</StemDirection>
Expand All @@ -171,6 +177,7 @@
<Dynamic>
<subtype>p</subtype>
<velocity>49</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
Expand All @@ -180,6 +187,11 @@
<tpc>19</tpc>
</Note>
</Chord>
<Dynamic>
<subtype>sf</subtype>
<velocity>33</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
<StemDirection>down</StemDirection>
Expand All @@ -195,6 +207,7 @@
<Dynamic>
<subtype>mp</subtype>
<velocity>64</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
Expand All @@ -204,6 +217,11 @@
<tpc>19</tpc>
</Note>
</Chord>
<Dynamic>
<subtype>sfz</subtype>
<velocity>33</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
<StemDirection>down</StemDirection>
Expand All @@ -215,6 +233,7 @@
<Dynamic>
<subtype>mf</subtype>
<velocity>80</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
Expand All @@ -224,6 +243,11 @@
<tpc>19</tpc>
</Note>
</Chord>
<Dynamic>
<subtype>fz</subtype>
<velocity>33</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
<StemDirection>down</StemDirection>
Expand All @@ -239,6 +263,7 @@
<Dynamic>
<subtype>f</subtype>
<velocity>96</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
Expand All @@ -248,6 +273,11 @@
<tpc>19</tpc>
</Note>
</Chord>
<Dynamic>
<subtype>fp</subtype>
<velocity>33</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
<StemDirection>down</StemDirection>
Expand All @@ -259,6 +289,7 @@
<Dynamic>
<subtype>ff</subtype>
<velocity>112</velocity>
<direction>down</direction>
</Dynamic>
<Chord>
<durationType>quarter</durationType>
Expand Down

0 comments on commit 386af37

Please sign in to comment.