Fix clef export in MusicXML#701
Conversation
| else if(clef == TGMeasure.CLEF_TREBLE){ | ||
| this.addNode(node, "sign", "G"); | ||
| this.addNode(node, "line", "2"); | ||
| this.addNode(node, "clef-octave-change", String.valueOf(-1)); |
There was a problem hiding this comment.
I think the original implementation is correct.
TuxGuitar is dedicated to guitar, and guitar is a transposing instrument, using a key 1 octave below the standard one (same for bass guitar).
Where TuxGuitar is wrong: it uses this convention silently, and doesn't display an explicit "8" below the clefs (as musescore does: just create an empty guitar track, the "8" is correctly shown)
If I'm not wrong, Musescore 4.5.1 uses the same "clef-octave-change" musicxml node.
See screenshots.
left : TuxGuitar
right: exported by TG1.6.6 in musicxml, and imported by musescore 4.5.1 (correct)
After applying your PR, and exporting to musicxml, this is how it appears in musescore (incorrect):
There was a problem hiding this comment.
We cannot use ottava clefs in export, because a) these are not the clefs TuxGuitar is using, and b) that wouldn't work with the c clefs (wich are not exported correctly currently).
Correct, guitar is a transposing instrument, but that wasn't shown in the export. The shown pitch is for both clefs the same, even if the old implementation showed the note on the "correct line".
The transposition information in this PR is now correct, but I need to adjust the pitch for the score staff.
There was a problem hiding this comment.
OK. Thanks for your contributions, I must admit I don't have a good knowledge of musicXML data structure.
|
I'm sorry but I think I still need some explanations. The note appears on the correct line in the score, however the representation of the clef omits the explicit "8" below the clef (it appears correctly before the PR). Why remove the "clef-octave-change" musicxml node? |
|
It looks like a conflict of octave numbering convention. TuxGuitar uses midi convention, so A4=440Hz. |
|
The MuseScore import is not correct, it cannot handle different transpositions in one part (yet). A violin clef marks the G4 on the second line, the 8 below the clef changes the written octave, so then it marks the G3. https://www.dacapoalcoda.com/octaves-clefs. The guitar is a transposing instrument sounding one ocatve lower than written, i.e. this would the sound like G2. MIDI does not know about about transposing instruments, but refelcts the sounding pitch. |
|
Let me take one step back (I'm trying to understand).
My conclusions:
@rettinghaus, two questions:
I may be wrong, but I have the impression that the only problem is the way TuxGuitar draws the clefs, omitting the -1 octave indication (applied implicitly) |
|
As said before, But this needs some more work. I'll open an issue on MuseScore side. |
|
Sorry but I still don't understand. Naively I would assume that the pitch is independent from the content of |
|
The The display of the written pitch is then calculated for the given clef, which depends on it's form, the line it sits on and the given |
|
OK, that's more clear! |










This fixes the export of clefs:
clef-octave-change(adding missingtransposeinformation instead)after-barlineattributesignfor c clefsOther changes just small formatting improvements.