Playing MIDI files

John Michelsen john.michelsen at gte.net
Fri Oct 8 00:04:36 EDT 1999


Here's something that works on windows if you have any program
that plays a midi when you double click on it. Works for mp3s and wavs
too.  There's probably some system call on unix that does the same thing.

import sys

def play_soundfile(filename):
    if sys.platform == 'win32':
        import win32api
        win32api.ShellExecute(0, "open", filename, None, "", 0)
    else:
        print "some unix commands here to play a sound file"

Martin Döring <mdoering at comlineag.de> wrote in message
news:37fa603f.3064486 at pumba.class.udg.mx...
> Hi!
>
> Is there a module to play midi-files from python?
>
> Martin Doering
>
> Martin Doering (mailto:mdoering at comlineag.de)
>
>       :|/\/\/\/\|:    Beware of the breeze
>       :|\/\/\/\/|:    of air when I squeeze






More information about the Python-list mailing list