< Back to IRCAM Forum

Clefs & .xml

Dear OMers, hello everyone.

I was wondering, and I probably missed it, if there was a way to retain the original clefs used in OpenMusic when exporting a score in XML format.
In other words, if in a poly I have one voice in bass clef and two in treble clef, is there a way to export the voice in bass clef while maintaining that clef?

I open the .xml file in MuseScore 4, so I don’t know if that’s a problem.

Also, even if I export a single line in treble clef, in the .xml file opened in MuseScore I see the treble clef constantly repeated for each measure. Is there a way to avoid this problem as well?

In any case, I’m looking into investing in LilyPond, which also seems like an excellent solution for multi-temporality.

Best regards and best wishes to everyone.

neo

Dear neo,

Will look into that. I don’t think that the export mxml supports exporting the clefs. But this is not a big issue. We can make it do so…
However it will not export “mixed clef” ie, [GF] clefs, etc. one staff on one clef, is possible.

Best
K

1 Like

Dear Neo,

Here is a patch to put in the init folder.
This fixes the repeated clefs in musescore and sets the clefs from OM editor as you requested. The patch if all is OK will be merged in OM’s code thanks to your suggestion.

xmlclefs.lisp (4.3 KB)

Best
K

Dear Maestro Haddad,

Thank you so much for your patch. I’ve tested it, including with other keys (soprano, alto, etc.), and it works perfectly.

Best regards,

neo

One thing though will not work is the OM’s “mixed clef” which sounds logical.
For the time being, if you have set a voice to GF for example, it will default to G…

Best
K

Dear Maestro Haddad,

Good point. I haven’t tried double or quadruple staves yet. I imagine this could be a further refinement, but so far what you’ve done is already a great improvement (I’ve lost count of how many treble clefs I’ve manually deleted).

Best regards,

neo

Dear Maestro Haddad,

I don’t know if this bug is related, but I didn’t noticed it before. Now the export-musicxml function gives this error message:

Screenshot 2025-09-16 alle 19.03.30

Thank you a lot for your time, best regards.

neo

xml.omp (5.4 KB)

Sorry,

My mistake (forgot the VOICE method.)
Please do replace the old file in init with this one:

xmlclefs1.lisp (4.9 KB)

BEst
K

1 Like