#!/usr/bin/env python

import MIDI

def sysex(bs): print 'sysex', map(ord, bs)

m = MIDI.In(sysex)

def foo(msg, *args): print msg, args

m[...] = foo

import os

while 1:
    bs = os.read(0, 1)
    if not bs: break
    m.inbytes(bs)
    

