Generating a drum score

I’m trying to generate a drum score using pymusicxml – in the version that just dropped, I can set the midi program number to 10 for percussion, but when I open it in MuseScore, it plays (as per the midi spec) as a glockenspiel. If I edit the part to have Drumset as an instrument and save it back out as a musicxml file, I see that (a.o.) it has

  <midi-instrument id="P1-I36">
    <midi-channel>10</midi-channel>
    <midi-program>1</midi-program>
    <midi-unpitched>36</midi-unpitched>
    <volume>78.7402</volume>
    <pan>0</pan>
    </midi-instrument>

stanzas, but I’m not sure whether this is the distinction that makes a difference. I don’t think I can currently add this through pymusicxml, but I’d be OK postprocessing the results with lxml if need be.

I’ve made a first attempt here but now I don’t get any sound when played in MuseScore – even if I manually reassign the drums instrument there.

Apologies for the slow response! I’ll try to take a look at this, but it may take a while, because I realize I overlooked unpitched percussion notation and playback in pymusicxml, and it seems to be quite a different beast than pitched instruments.

I wonder if you could maybe generate the notation, open it in MuseScore, add a drumset part, and then copy/paste the notes from your generated part into that drumset part?

I can just the instrument for the measures, that fixes it, but I’m looking for a way to generate the lot from python.