cuthbertLab / music21

music21 is a Toolkit for Computational Musicology
https://www.music21.org/
Other
2.09k stars 397 forks source link

Percussion to midi #238

Closed Rajon010 closed 2 years ago

Rajon010 commented 7 years ago

I'm wondering what is the right way to write percussion to midi files.

My code: from music21 import * myScore = stream.Score() percussionPart = stream.Part() pm = midi.percussion.PercussionMapper() percussionPart.append(pm.midiPitchToInstrument(36)) myScore.insert(0, percussionPart) myScore.write('midi', fp='lalala.midi')

always runs into the error: midi.base.py: WARNING: Conversion error for <MidiEvent PROGRAM_CHANGE, t=0, track=1, channel=1>: Got incorrect data for <MidiEvent PROGRAM_CHANGE, t=0, track=1, channel=1> in .data: None,cannot parse Program Change; ignored.

How can I assign channel 10 (for percussion) of midi to notes in the percussion part or the percussion part itself?

mscuthbert commented 7 years ago

Percussion isn't currently supported in MIDI output.

We can patch this with a pull-request but since it's not likely to happen soon, I'll close it, since additional percussion support is on the tracking items.

jacobtylerwalls commented 2 years ago

I can take a look at this for v8, since we've made a lot of progress with Unpitched and PercussionChord recently.