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

MusicXML: Add export for smufl noteheads #19506

Merged
merged 5 commits into from Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/importexport/musicxml/internal/musicxml/exportxml.cpp
Expand Up @@ -3569,6 +3569,8 @@ static void writeNotehead(XmlWriter& xml, const Note* const note)
xml.tagRaw(noteheadTagname, "cross");
} else if (note->headGroup() == NoteHeadGroup::HEAD_CROSS) {
xml.tagRaw(noteheadTagname, "x");
} else if (note->headGroup() == NoteHeadGroup::HEAD_CIRCLED) {
xml.tagRaw(noteheadTagname, "circled");
} else if (note->headGroup() == NoteHeadGroup::HEAD_XCIRCLE) {
xml.tagRaw(noteheadTagname, "circle-x");
} else if (note->headGroup() == NoteHeadGroup::HEAD_TRIANGLE_DOWN) {
Expand Down Expand Up @@ -3599,6 +3601,10 @@ static void writeNotehead(XmlWriter& xml, const Note* const note)
xml.tagRaw(noteheadTagname, "normal");
} else if (note->headType() != NoteHeadType::HEAD_AUTO) {
xml.tagRaw(noteheadTagname, "normal");
} else if (note->headGroup() != NoteHeadGroup::HEAD_NORMAL) {
AsciiStringView noteheadName = SymNames::nameForSymId(note->noteHead());
noteheadTagname += QString(" smufl=\"%1\"").arg(noteheadName.ascii());
xml.tagRaw(noteheadTagname, "other");
}
}

Expand Down
Expand Up @@ -1220,11 +1220,13 @@ static NoteHeadGroup convertNotehead(QString mxmlName)
map["diamond"] = int(NoteHeadGroup::HEAD_DIAMOND);
map["cross"] = int(NoteHeadGroup::HEAD_PLUS);
map["x"] = int(NoteHeadGroup::HEAD_CROSS);
map["circled"] = int(NoteHeadGroup::HEAD_CIRCLED);
map["circle-x"] = int(NoteHeadGroup::HEAD_XCIRCLE);
map["inverted triangle"] = int(NoteHeadGroup::HEAD_TRIANGLE_DOWN);
map["slashed"] = int(NoteHeadGroup::HEAD_SLASHED1);
map["back slashed"] = int(NoteHeadGroup::HEAD_SLASHED2);
map["normal"] = int(NoteHeadGroup::HEAD_NORMAL);
map["rectangle"] = int(NoteHeadGroup::HEAD_LA);
map["do"] = int(NoteHeadGroup::HEAD_DO);
map["re"] = int(NoteHeadGroup::HEAD_RE);
map["mi"] = int(NoteHeadGroup::HEAD_MI);
Expand Down
365 changes: 365 additions & 0 deletions src/importexport/musicxml/tests/data/testNoteheads2.mscx
@@ -0,0 +1,365 @@
<?xml version="1.0" encoding="UTF-8"?>
<museScore version="4.20">
<programVersion>4.2.0</programVersion>
<programRevision>3fc7989</programRevision>
<Score>
<Division>480</Division>
<showInvisible>1</showInvisible>
<showUnprintable>1</showUnprintable>
<showFrames>1</showFrames>
<showMargins>0</showMargins>
<open>1</open>
<metaTag name="arranger"></metaTag>
<metaTag name="composer">Klaus Rettinghaus</metaTag>
<metaTag name="copyright"></metaTag>
<metaTag name="creationDate">2023-09-30</metaTag>
<metaTag name="lyricist"></metaTag>
<metaTag name="platform"></metaTag>
<metaTag name="source"></metaTag>
<metaTag name="subtitle"></metaTag>
<metaTag name="translator"></metaTag>
<metaTag name="workTitle">Full range of noteheads</metaTag>
<Part id="1">
<Staff id="1">
<StaffType group="pitched">
<name>stdNormal</name>
</StaffType>
</Staff>
<trackName>Piano</trackName>
<Instrument id="piano">
<longName>Piano</longName>
<trackName>Piano</trackName>
<minPitchP>21</minPitchP>
<maxPitchP>108</maxPitchP>
<minPitchA>21</minPitchA>
<maxPitchA>108</maxPitchA>
<instrumentId>keyboard.piano</instrumentId>
<clef staff="2">F</clef>
<Articulation>
<velocity>100</velocity>
<gateTime>95</gateTime>
</Articulation>
<Articulation name="staccatissimo">
<velocity>100</velocity>
<gateTime>33</gateTime>
</Articulation>
<Articulation name="staccato">
<velocity>100</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="portato">
<velocity>100</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="tenuto">
<velocity>100</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="marcato">
<velocity>120</velocity>
<gateTime>67</gateTime>
</Articulation>
<Articulation name="sforzato">
<velocity>150</velocity>
<gateTime>100</gateTime>
</Articulation>
<Articulation name="sforzatoStaccato">
<velocity>150</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="marcatoStaccato">
<velocity>120</velocity>
<gateTime>50</gateTime>
</Articulation>
<Articulation name="marcatoTenuto">
<velocity>120</velocity>
<gateTime>100</gateTime>
</Articulation>
<Channel>
<program value="0"/>
<controller ctrl="10" value="63"/>
<synti>Fluid</synti>
</Channel>
</Instrument>
</Part>
<Staff id="1">
<VBox>
<height>5</height>
<boxAutoSize>0</boxAutoSize>
<Text>
<style>title</style>
<text>Full range of noteheads</text>
</Text>
</VBox>
<Measure>
<voice>
<Clef>
<concertClefType>G</concertClefType>
<transposingClefType>G</transposingClefType>
<isHeader>1</isHeader>
</Clef>
<TimeSig>
<sigN>2</sigN>
<sigD>4</sigD>
</TimeSig>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>cross</head>
<dead>1</dead>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>plus</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>xcircle</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>withx</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>triangle-up</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>triangle-down</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>slashed1</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>slashed2</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>diamond</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>diamond-old</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>circled</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>circled-large</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>large-arrow</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>altbrevis</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>slash</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>large-diamond</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>sol</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>la</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>fa</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>mi</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>do</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>re</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>ti</head>
</Note>
</Chord>
</voice>
</Measure>
<Measure>
<voice>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>heavy-cross</head>
</Note>
</Chord>
<Chord>
<durationType>quarter</durationType>
<Note>
<pitch>67</pitch>
<tpc>15</tpc>
<head>heavy-cross-hat</head>
</Note>
</Chord>
</voice>
</Measure>
</Staff>
</Score>
</museScore>