Skip to content

Instantly share code, notes, and snippets.

@Echooff3
Created November 24, 2021 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Echooff3/8089edae3c104bf292d2a9de2591f527 to your computer and use it in GitHub Desktop.
Save Echooff3/8089edae3c104bf292d2a9de2591f527 to your computer and use it in GitHub Desktop.
Python - Change midi channel 1 to 10 (converting midi drum samples)
from mido import MidiFile
from pathlib import Path
for name in Path('./ConvertThis').rglob('*.mid'):
print(name)
mid = MidiFile(name, clip=True)
for message in mid.tracks[0]:
if message.type in ('note_on','note_off'):
message.copy(channel=9)
mid.save(name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment