[LAU] slowing down sysex dumps

Tim Goetze tim at quitte.de
Sat Feb 2 10:41:47 UTC 2013


[Brent Busby]
> Is there anything you can do on Linux to transmit a sysex file more slowly?
> I'm not sure, but I think it may help if the data wasn't coming in so fast.

sysex files being raw data dumps and ALSA devices being accessible
through a raw file interface, this works for me:

#! /usr/bin/env python
import time,sys
midi = open(sys.argv[1],'w')
data = sys.stdin.read()
for c in data[:-1]:
	midi.write(c)
	midi.flush()
	# sleep 2 seconds after EOX, 1 ms otherwise
	time.sleep (c == "\xf7" and 2 or .001) 
midi.write(data[-1])
# EOF

$ cat file.syx | theabovescript.py /dev/snd/midiCxDy 

Obviously, midiCxDy needs to be replaced with the proper device path,
x and y being card number and subdevice, and you may need or want to
adjust the delay constants.  Some devices need extra time to process
complete sysex bulks before being ready for the next so an extra delay
is triggered by interspersed EOX markers.


More information about the Linux-audio-user mailing list