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

Correct dynamics on import from Finale #500

Draft
wants to merge 2 commits into
base: 3.x
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions importexport/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3903,6 +3903,19 @@ void MusicXMLParserDirection::textToDynamic(QString& text) const
if (!preferences.getBool(PREF_IMPORT_MUSICXML_IMPORTINFERTEXTTYPE))
return;
QString simplifiedText = text.simplified();
// Correct finale's incorrect dynamic export
if (_pass1.exporterSoftware() == MusicXMLExporterSoftware::FINALE) {
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;
break;
}
}
}
for (auto dyn : dynList) {
if (dyn.tag == simplifiedText) {
text = text.replace(simplifiedText, dyn.text);
Expand Down
305 changes: 305 additions & 0 deletions mtest/musicxml/io/testFinaleDynamics.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 4.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="4.0">
<work>
<work-title>Untitled score</work-title>
</work>
<identification>
<creator type="composer">Composer / arranger</creator>
<encoding>
<software>Finale v27.4 for Windows</software>
<encoding-date>2024-05-20</encoding-date>
<supports attribute="new-system" element="print" type="yes" value="yes"/>
<supports attribute="new-page" element="print" type="yes" value="yes"/>
<supports element="accidental" type="yes"/>
<supports element="beam" type="yes"/>
<supports element="stem" type="yes"/>
</encoding>
</identification>
<defaults>
<scaling>
<millimeters>6.99911</millimeters>
<tenths>40</tenths>
</scaling>
<page-layout>
<page-height>1696.94</page-height>
<page-width>1200.48</page-width>
<page-margins type="even">
<left-margin>85.7252</left-margin>
<right-margin>85.7252</right-margin>
<top-margin>85.7252</top-margin>
<bottom-margin>85.7252</bottom-margin>
</page-margins>
<page-margins type="odd">
<left-margin>85.7252</left-margin>
<right-margin>85.7252</right-margin>
<top-margin>85.7252</top-margin>
<bottom-margin>85.7252</bottom-margin>
</page-margins>
</page-layout>
<appearance>
<line-width type="light barline">1.8</line-width>
<line-width type="heavy barline">5.5</line-width>
<line-width type="beam">5</line-width>
<line-width type="bracket">4.5</line-width>
<line-width type="dashes">1</line-width>
<line-width type="enclosure">1</line-width>
<line-width type="ending">1.1</line-width>
<line-width type="extend">1</line-width>
<line-width type="leger">1.6</line-width>
<line-width type="pedal">1.1</line-width>
<line-width type="octave shift">1.1</line-width>
<line-width type="slur middle">2.1</line-width>
<line-width type="slur tip">0.5</line-width>
<line-width type="staff">1.1</line-width>
<line-width type="stem">1</line-width>
<line-width type="tie middle">2.1</line-width>
<line-width type="tie tip">0.5</line-width>
<line-width type="tuplet bracket">1</line-width>
<line-width type="wedge">1.2</line-width>
<note-size type="cue">70</note-size>
<note-size type="grace">70</note-size>
<note-size type="grace-cue">49</note-size>
</appearance>
<music-font font-family="Leland"/>
<word-font font-family="Edwin" font-size="10"/>
<lyric-font font-family="Edwin" font-size="10"/>
</defaults>
<part-list>
<score-part id="P1">
<part-name>Flute</part-name>
<part-abbreviation>Fl.</part-abbreviation>
<score-instrument id="P1-I1">
<instrument-name>Flute</instrument-name>
<instrument-sound>wind.flutes.flute</instrument-sound>
</score-instrument>
<midi-device id="P1-I1" port="1"></midi-device>
<midi-instrument id="P1-I1">
<midi-channel>1</midi-channel>
<midi-program>74</midi-program>
<volume>78.7402</volume>
<pan>0</pan>
</midi-instrument>
</score-part>
</part-list>
<part id="P1">
<measure number="1" width="368.09">
<print>
<system-layout>
<system-margins>
<left-margin>50</left-margin>
<right-margin>-0</right-margin>
</system-margins>
<top-system-distance>70</top-system-distance>
</system-layout>
</print>
<attributes>
<divisions>1</divisions>
<key>
<fifths>0</fifths>
</key>
<time>
<beats>4</beats>
<beat-type>4</beat-type>
</time>
<clef>
<sign>G</sign>
<line>2</line>
</clef>
</attributes>
<direction placement="below">
<direction-type>
<words default-y="-63" font-family="Scarlatti" font-size="14.4">π</words>
</direction-type>
<sound dynamics="36.67"/>
</direction>
<note default-x="80.22" default-y="-20">
<pitch>
<step>B</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<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>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
</note>
<direction placement="below">
<direction-type>
<words default-y="-63" font-family="Scarlatti" font-size="14.4">p</words>
</direction-type>
<sound dynamics="54.44"/>
</direction>
<note default-x="223.25" default-y="-20">
<pitch>
<step>B</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<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>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
</note>
</measure>
<measure number="2" width="300.87">
<direction placement="below">
<direction-type>
<words default-y="-63" font-family="Scarlatti" font-size="14.4">P</words>
</direction-type>
<sound dynamics="71.11"/>
</direction>
<note default-x="13" default-y="-20">
<pitch>
<step>B</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<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>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
</note>
<direction placement="below">
<direction-type>
<words default-y="-62" font-family="Scarlatti" font-size="14.4" relative-x="-9">F</words>
</direction-type>
<sound dynamics="88.89"/>
</direction>
<note default-x="156.04" default-y="-20">
<pitch>
<step>B</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<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>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
</note>
</measure>
<measure number="3" width="310.07">
<direction placement="below">
<direction-type>
<words default-y="-63" font-family="Scarlatti" font-size="14.4">f</words>
</direction-type>
<sound dynamics="106.67"/>
</direction>
<note default-x="13" default-y="-20">
<pitch>
<step>B</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<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>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
</note>
<direction placement="below">
<direction-type>
<words default-y="-63" font-family="Scarlatti" font-size="14.4">ƒ</words>
</direction-type>
<sound dynamics="124.44"/>
</direction>
<note default-x="156.04" default-y="-20">
<pitch>
<step>B</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
</note>
<note default-x="227.55" default-y="-20">
<pitch>
<step>B</step>
<octave>4</octave>
</pitch>
<duration>1</duration>
<voice>1</voice>
<type>quarter</type>
<stem>down</stem>
</note>
<barline location="right">
<bar-style>light-heavy</bar-style>
</barline>
</measure>
</part>
</score-partwise>
Loading
Loading