-
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
MusicXML alter element not exported #23063
Comments
As far as I remember, this was never implemented. |
So it more like a feature request |
Hi I have been looking into the code and it should work with the following patch (please, read the complete comment)
With this patch you would get this xml: rast-tetrachord.zip. Could you please tell me @infojunkie if this is correct ? However, I think this should be reviewed by an expert because if you dig into the code it seems that there are different types of "alter"
tpc in note.h
and it's used in exportxml.cpp
Any case I think the proposed patch is harmless because only if current alter and alter2 are empty the program adds the "alter" tag with the desired logic and would not impact at all if current alter or alter2 are used to generate the XML Kind regards |
This comment was marked as outdated.
This comment was marked as outdated.
Hi OK @Jojo-Schmitz , ¿ Could you please asign this issue to me ? Kind regards |
This comment was marked as outdated.
This comment was marked as outdated.
Hi I have already created a pull request as you can see above. After that it ocurred to me to make a different test:
Results are:
They should not be different but if you analyze the result in the exported-imported-exported file:
The notes in both files sound the same to me, but they look different in MuseScore
So, perhaps we should also review the import methods. Kind regard |
Yes, I noticed that too when loading those 2 files. Seems indeed an import issue, see also https://musescore.org/en/node/303920 See also the 4 years old issue https://musescore.org/en/node/311792 |
With regards to the import issues: microtonal accidentals are guessed from the alter value on import. This is fine in itself, but the note's tuning must also be set when setting the note's accidental (in |
Would this work for import? diff --git a/src/importexport/musicxml/internal/musicxml/importmxmlnotepitch.cpp b/src/importexport/musicxml/internal/musicxml/importmxmlnotepitch.cpp
index a55773b1aa..20524bdbb5 100644
--- a/src/importexport/musicxml/internal/musicxml/importmxmlnotepitch.cpp
+++ b/src/importexport/musicxml/internal/musicxml/importmxmlnotepitch.cpp
@@ -129,6 +129,7 @@ void MxmlNotePitch::pitch(muse::XmlStreamReader& e)
// defaults
m_step = -1;
m_alter = 0;
+ m_microtonalAlter = 0.0;
m_octave = -1;
while (e.readNextStartElement()) {
@@ -145,6 +146,7 @@ void MxmlNotePitch::pitch(muse::XmlStreamReader& e)
m_accType = microtonalGuess(altervalue);
}
m_alter = 0;
+ m_microtonalAlter = altervalue;
}
} else if (e.name() == "octave") {
const String oct = e.readText();
diff --git a/src/importexport/musicxml/internal/musicxml/importmxmlnotepitch.h b/src/importexport/musicxml/internal/musicxml/importmxmlnotepitch.h
index 3c4ebf5e5d..746bb2cae1 100644
--- a/src/importexport/musicxml/internal/musicxml/importmxmlnotepitch.h
+++ b/src/importexport/musicxml/internal/musicxml/importmxmlnotepitch.h
@@ -48,6 +48,7 @@ public:
Accidental* acc() const { return m_acc; }
AccidentalType accType() const { return m_accType; }
int alter() const { return m_alter; }
+ int microtonalAlter() const { return m_microtonalAlter; }
int displayOctave() const { return m_displayOctave; }
int displayStep() const { return m_displayStep; }
void displayStepOctave(muse::XmlStreamReader& e);
@@ -59,6 +60,7 @@ private:
Accidental* m_acc = nullptr; // created based on accidental element
AccidentalType m_accType = AccidentalType::NONE; // set by pitch() based on alter value (can be microtonal)
int m_alter = 0;
+ double m_microtonalAlter = 0.0;
int m_displayStep = -1; // invalid
int m_displayOctave = -1; // invalid
int m_octave = -1;
diff --git a/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp b/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp
index 4b566615b3..6d80d46382 100644
--- a/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp
+++ b/src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp
@@ -6405,6 +6405,7 @@ static void setPitch(Note* note, const MusicXMLInstruments& instruments, const S
}
} else {
xmlSetPitch(note, mnp.step(), mnp.alter(), mnp.octave(), octaveShift, instrument);
+ note->setTuning(mnp.microtonalAlter());
}
}
|
HI I have been also working on a patch and I have just finished now. It works
|
Quite similar to mine (and mine is entirely untested). Feel free to PR it, I try to not interfere again ;-) |
Yep, this looks good @pacebes! If you make a PR I'll add 1 piece of feedback. |
HI (Edited) Just one think. As long as this new patch is about "import" instead of "export". Is it right to link the new PR to this issue (export) or should we create another issue or at least change the "title" of this issue ? |
Yes, as all discussion is here it's fine to link this one |
Your code does correctly import the tunings (I can see them being set in the properties), but they don't sound?!? |
HI It does sound in my computer. There is a Video with the recording: Imported.xml.with.tuning.mp4The only difference (format) between the original and the exported-then-imported is the first E
Both are equivalent. |
The one with the quarter tone accidental sounds quarter tone, the others just regular semitone |
No, you're right, they do sound. |
…ntNotExported Fix #23063: (import) MusicXML alter element not exported
Issue type
Import/export issue
Bug description
The MusicXML alter element is not exported when a note has a tuning.
Steps to reproduce
<alter>
element is missing. It should show:Screenshots/Screen recordings
No response
MuseScore Version
4.3.1-241490902, revision: github-musescore-musescore-026c26b
Regression
I don't know
Operating system
Pop!_OS 22.04 LTS
Additional context
No response
The text was updated successfully, but these errors were encountered: