Skip to content

Instantly share code, notes, and snippets.

@illume
Created Oct 14, 2019
Embed
What would you like to do?
How to play midi music with pygame.mixer.music.
# midimusic.py
# curl -O https://upload.wikimedia.org/wikipedia/commons/5/55/MIDI_sample.mid
import time, sys, pygame
pygame.mixer.init()
pygame.mixer.music.load('MIDI_sample.mid')
pygame.mixer.music.play()
while pygame.mixer.music.get_busy():
print('Still playing :)')
time.sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment