diff --git a/importexport/musicxml/exportxml.cpp b/importexport/musicxml/exportxml.cpp
index e709d477e5327..feb90d9e5b51a 100644
--- a/importexport/musicxml/exportxml.cpp
+++ b/importexport/musicxml/exportxml.cpp
@@ -3648,6 +3648,24 @@ static void writeNotehead(XmlWriter& xml, const Note* const note)
noteheadTagname += QString(" smufl=\"%1\"").arg(noteheadName);
xml.tag(noteheadTagname, "other");
}
+
+ if (note->headScheme() == NoteHead::Scheme::HEAD_PITCHNAME
+ || note->headScheme() == NoteHead::Scheme::HEAD_PITCHNAME_GERMAN
+ || note->headScheme() == NoteHead::Scheme::HEAD_SOLFEGE
+ || note->headScheme() == NoteHead::Scheme::HEAD_SOLFEGE_FIXED) {
+ static const QRegExp nameparts("^note([A-Z][a-z]*)(Sharp|Flat)?");
+ const char* noteheadName = Sym::id2name(note->noteHead());
+#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
+ QStringList matches = QString::fromLatin1(noteheadName).split(nameparts, Qt::SkipEmptyParts);
+#else
+ QStringList matches = QString::fromLatin1(noteheadName).split(nameparts, QString::SkipEmptyParts);
+#endif
+ xml.stag("notehead-text");
+ xml.tag("display-text", matches.at(0));
+ if (matches.size() > 1)
+ xml.tag("accidental-text", matches.at(1).toLower());
+ xml.etag();
+ }
}
//---------------------------------------------------------
diff --git a/importexport/musicxml/importmxmlpass2.cpp b/importexport/musicxml/importmxmlpass2.cpp
index 287611c09bc8c..0b83bd9b983c8 100644
--- a/importexport/musicxml/importmxmlpass2.cpp
+++ b/importexport/musicxml/importmxmlpass2.cpp
@@ -6184,10 +6184,25 @@ Note* MusicXMLParserPass2::note(const QString& partId,
if (noteheadValue == "none")
hasHead = false;
else if (noteheadValue == "named" && _pass1.exporterSoftware() == MusicXMLExporterSoftware::NOTEFLIGHT)
- headScheme = NoteHead::Scheme::HEAD_PITCHNAME;
+ headScheme = NoteHead::Scheme::HEAD_PITCHNAME; // NoteHead::Scheme::HEAD_PITCHNAME_GERMAN is not an option here?
else
headGroup = convertNotehead(noteheadValue);
}
+ else if (_e.name() == "notehead-text") {
+ QString noteheadText;
+ while (_e.readNextStartElement()) {
+ if (_e.name() == "display-text")
+ noteheadText = _e.readElementText();
+ else if (_e.name() == "accidental-text")
+ _e.skipCurrentElement();
+ else
+ skipLogCurrElem();
+ }
+ if (noteheadText.size() == 1)
+ headScheme = (noteheadText == "H") ? NoteHead::Scheme::HEAD_PITCHNAME_GERMAN : NoteHead::Scheme::HEAD_PITCHNAME;
+ else
+ headScheme = NoteHead::Scheme::HEAD_SOLFEGE_FIXED;
+ }
else if (_e.name() == "rest") {
rest = true;
measureRest = _e.attributes().value("measure") == "yes";
diff --git a/mtest/musicxml/io/testNoteheadNames.mscx b/mtest/musicxml/io/testNoteheadNames.mscx
new file mode 100644
index 0000000000000..d931baaf91e8f
--- /dev/null
+++ b/mtest/musicxml/io/testNoteheadNames.mscx
@@ -0,0 +1,600 @@
+
+
+
+
+ 0
+ 480
+
+ 1
+ 1
+ 1
+ 0
+
+
+ Klaus Rettinghaus
+
+
+
+
+
+
+
+
+
+
+
+ Notehead names
+
+ Orchestra
+
+ Stimmen
+
+
+ flutes
+ oboes
+ clarinets
+ saxophones
+ bassoons
+
+
+
+ horns
+ trumpets
+ cornets
+ flugelhorns
+ trombones
+ tubas
+
+
+
+
+ keyboard-percussion
+
+ drums
+ unpitched-metal-percussion
+ unpitched-wooden-percussion
+ other-percussion
+
+
+ keyboards
+ harps
+ organs
+ synths
+
+
+
+ voices
+ voice-groups
+
+
+
+
+
+
+ stdNormal
+
+
+ Voice
+
+ Voice
+ Vo.
+ Voice
+ 38
+ 84
+ 41
+ 79
+ voice.vocals
+
+
+ Fluid
+
+
+
+
+
+ 5
+ 0
+
+
+ Notehead names
+
+
+
+
+
+ 4
+ 4
+
+
+ quarter
+
+ 60
+ 14
+ name-pitch
+
+
+
+ quarter
+
+ 62
+ 16
+ name-pitch
+
+
+
+ quarter
+
+ 64
+ 18
+ name-pitch
+
+
+
+ quarter
+
+ 65
+ 13
+ name-pitch
+
+
+
+
+
+
+
+ quarter
+
+ 67
+ 15
+ name-pitch
+
+
+
+ quarter
+
+ 69
+ 17
+ name-pitch
+
+
+
+ quarter
+
+ 71
+ 19
+ name-pitch
+
+
+
+ quarter
+
+ 72
+ 14
+ name-pitch
+
+
+
+
+
+
+
+ quarter
+
+ 64
+ 18
+ name-pitch
+
+
+
+ quarter
+
+
+ accidentalSharp
+
+ 66
+ 20
+ name-pitch
+
+
+
+ quarter
+
+
+ accidentalSharp
+
+ 68
+ 22
+ name-pitch
+
+
+
+ quarter
+
+ 69
+ 17
+ name-pitch
+
+
+
+
+
+
+
+ quarter
+
+ 71
+ 19
+ name-pitch
+
+
+
+ quarter
+
+
+ accidentalSharp
+
+ 73
+ 21
+ name-pitch
+
+
+
+ quarter
+
+
+ accidentalSharp
+
+ 75
+ 23
+ name-pitch
+
+
+
+ quarter
+
+ 76
+ 18
+ name-pitch
+
+
+
+ double
+
+
+
+
+
+
+ quarter
+
+ 60
+ 14
+ solfege-fixed
+
+
+
+ quarter
+
+ 62
+ 16
+ solfege-fixed
+
+
+
+ quarter
+
+ 64
+ 18
+ solfege-fixed
+
+
+
+ quarter
+
+ 65
+ 13
+ solfege-fixed
+
+
+
+
+
+
+
+ quarter
+
+ 67
+ 15
+ solfege-fixed
+
+
+
+ quarter
+
+ 69
+ 17
+ solfege-fixed
+
+
+
+ quarter
+
+ 71
+ 19
+ solfege-fixed
+
+
+
+ quarter
+
+ 72
+ 14
+ solfege-fixed
+
+
+
+
+
+
+
+ quarter
+
+
+ accidentalSharp
+
+ 61
+ 21
+ solfege-movable
+
+
+
+ quarter
+
+
+ accidentalFlat
+
+ 61
+ 9
+ solfege-movable
+
+
+
+ quarter
+
+
+ accidentalSharp
+
+ 63
+ 23
+ solfege-movable
+
+
+
+ quarter
+
+
+ accidentalFlat
+
+ 63
+ 11
+ solfege-movable
+
+
+
+
+
+
+
+ quarter
+
+
+ accidentalSharp
+
+ 66
+ 20
+ solfege-movable
+
+
+
+ quarter
+
+
+ accidentalFlat
+
+ 66
+ 8
+ solfege-movable
+
+
+
+ quarter
+
+
+ accidentalSharp
+
+ 70
+ 24
+ solfege-movable
+
+
+
+ quarter
+
+
+ accidentalFlat
+
+ 70
+ 12
+ solfege-movable
+
+
+
+ double
+
+
+
+
+
+
+ quarter
+
+ 60
+ 14
+ name-pitch-german
+
+
+
+ quarter
+
+ 62
+ 16
+ name-pitch-german
+
+
+
+ quarter
+
+ 64
+ 18
+ name-pitch-german
+
+
+
+ quarter
+
+ 65
+ 13
+ name-pitch-german
+
+
+
+
+
+
+
+ quarter
+
+ 67
+ 15
+ name-pitch-german
+
+
+
+ quarter
+
+ 69
+ 17
+ name-pitch-german
+
+
+
+ quarter
+
+ 71
+ 19
+ name-pitch-german
+
+
+
+ quarter
+
+ 72
+ 14
+ name-pitch-german
+
+
+
+
+
+
+
+ quarter
+
+
+ accidentalFlat
+
+ 63
+ 11
+ name-pitch-german
+
+
+
+ quarter
+
+ 65
+ 13
+ name-pitch-german
+
+
+
+ quarter
+
+ 67
+ 15
+ name-pitch-german
+
+
+
+ quarter
+
+
+ accidentalFlat
+
+ 68
+ 10
+ name-pitch-german
+
+
+
+
+
+
+
+ quarter
+
+
+ accidentalFlat
+
+ 70
+ 12
+ name-pitch-german
+
+
+
+ quarter
+
+ 72
+ 14
+ name-pitch-german
+
+
+
+ quarter
+
+ 74
+ 16
+ name-pitch-german
+
+
+
+ quarter
+
+
+ accidentalFlat
+
+ 75
+ 11
+ name-pitch-german
+
+
+
+
+
+
+
diff --git a/mtest/musicxml/io/testNoteheadNames_ref.xml b/mtest/musicxml/io/testNoteheadNames_ref.xml
new file mode 100644
index 0000000000000..bfb181dc8887a
--- /dev/null
+++ b/mtest/musicxml/io/testNoteheadNames_ref.xml
@@ -0,0 +1,747 @@
+
+
+
+
+ Notehead names
+
+
+ Klaus Rettinghaus
+
+ MuseScore 0.7.0
+ 2007-09-10
+
+
+
+
+
+
+
+
+
+ Voice
+ Vo.
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+ down
+
+ H
+
+
+
+
+ C
+ 5
+
+ 1
+ 1
+ quarter
+ down
+
+ C
+
+
+
+
+
+
+ E
+ -1
+ 4
+
+ 1
+ 1
+ quarter
+ flat
+ up
+
+ E
+ flat
+
+
+
+
+ F
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+ F
+
+
+
+
+ G
+ 4
+
+ 1
+ 1
+ quarter
+ up
+
+ G
+
+
+
+
+ A
+ -1
+ 4
+
+ 1
+ 1
+ quarter
+ flat
+ up
+
+ A
+ flat
+
+
+
+
+
+
+ B
+ -1
+ 4
+
+ 1
+ 1
+ quarter
+ flat
+ down
+
+ B
+
+
+
+
+ C
+ 5
+
+ 1
+ 1
+ quarter
+ down
+
+ C
+
+
+
+
+ D
+ 5
+
+ 1
+ 1
+ quarter
+ down
+
+ D
+
+
+
+
+ E
+ -1
+ 5
+
+ 1
+ 1
+ quarter
+ flat
+ down
+
+ E
+ flat
+
+
+
+ light-heavy
+
+
+
+
diff --git a/mtest/musicxml/io/tst_mxml_io.cpp b/mtest/musicxml/io/tst_mxml_io.cpp
index a5de697cdc573..4011744bfd1a7 100644
--- a/mtest/musicxml/io/tst_mxml_io.cpp
+++ b/mtest/musicxml/io/tst_mxml_io.cpp
@@ -247,6 +247,7 @@ private slots:
void noteAttributes3() { mxmlIoTest("testNoteAttributes3"); }
void noteAttributes4() { mxmlImportTestRef("testNoteAttributes2"); }
void noteColor() { mxmlIoTest("testNoteColor"); }
+ void noteheadNames() { mxmlMscxExportTestRef("testNoteheadNames"); }
void noteheadParentheses() { mxmlIoTest("testNoteheadParentheses"); }
void noteheads() { mxmlIoTest("testNoteheads"); }
void noteheads2() { mxmlMscxExportTestRef("testNoteheads2"); }