Re: [LAU] slowing down sysex dumps

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Brent Busby <brent@...>
Cc: Linux Audio User <linux-audio-user@...>
Date: Saturday, February 2, 2013 - 10:37 am

[Brent Busby]

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.
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-user

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAU] slowing down sysex dumps, Brent Busby, (Sat Feb 2, 6:15 am)
Re: [LAU] slowing down sysex dumps, Tim Goetze, (Sat Feb 2, 10:37 am)