Dear list,

When exporting a simple track, just containing 4 notes (B B# A# Cb) the 
resulting Music XML file looks like:

<note>
        <pitch>
                <step>B</step>
                <octave>4</octave>
        </pitch>
        <duration>960</duration>
        <voice>1</voice>
        <type>quarter</type>
</note>
<note>
        <pitch>
                <step>C</step>
                <octave>5</octave>
        </pitch>
        <duration>960</duration>
        <voice>1</voice>
        <type>quarter</type>
</note>
<note>
        <pitch>
                <step>B</step>
                <alter>1</alter>
                <octave>4</octave>
        </pitch>
        <duration>960</duration>
        <voice>1</voice>
        <type>quarter</type>
        <accidental>flat</accidental>
</note>
<note>
        <pitch>
                <step>B</step>
                <octave>4</octave>
        </pitch>
        <duration>960</duration>
                <voice>1</voice>
        <type>quarter</type>
        <accidental>natural</accidental>
</note>

The first note is okay. The second note looks strange, in Rosegarden it was a 
B#, in the XML file is became a C. I can live with this but it not 100% 
correct.
The next note however is wrong. The A# in Rosegarden now becomes a B# !! The 
added <accidental>flat</accidental> seems to be ignored by programs reading 
MusicXML, like mscore. It know yet what to purpose of this item is, I have to 
dive into MusicXML in more detail.

It seems the problem is in MusicXMLExporter::writeNote(). There a pitch is 
created:

long p = 0;
e->get<Int>(PITCH, p);
pitch = p;

However this construction ignores the event property "accidental".
Replacing this code by

pitch = Pitch(*e);

now correct notes are in the MusicXML file.

<note>
        <pitch>
                <step>B</step>
                <octave>4</octave>
        </pitch>
        <duration>960</duration>
        <voice>1</voice>
        <type>quarter</type>
</note>
<note>
        <pitch>
                <step>B</step>
                <alter>1</alter>
                <octave>5</octave>
        </pitch>
        <duration>960</duration>
        <voice>1</voice>
        <type>quarter</type>
        <accidental>sharp</accidental>
</note>
<note>
        <pitch>
                <step>A</step>
                <alter>1</alter>
                <octave>4</octave>
        </pitch>
        <duration>960</duration>
        <voice>1</voice>
        <type>quarter</type>
        <accidental>sharp</accidental>
</note>
<note>
        <pitch>
                <step>C</step>
                <alter>-1</alter>
                <octave>4</octave>
        </pitch>
        <duration>960</duration>
        <voice>1</voice>
        <type>quarter</type>
        <accidental>flat</accidental>
</note>

I'm willing to create a patch but I still have another problem. Now at least 
the notes are correct (B B# A# Cb) but the B# is one octave too high and the 
Cb is one octave too low. It looks to me Pitch::getOctave(octaveBase) is doing 
something strange because it ignores the pitch accidental. But this method is 
called in several places and I'm not sure what will be broken when changing 
this. Maybe somebody can comment on this?

Best regards,

Niek.

------------------------------------------------------------------------------

_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to