Real time event accuracy
Paul Rubin
no.email at nospam.invalid
Wed May 9 14:30:04 EDT 2012
Tobiah <toby at tobiah.org> writes:
> I'd like to send MIDI events from python to another
> program. I'd like advice as to how to accurately
> time the events. I'll have a list of floating point
> start times in seconds for the events, and I'd like to send them
> off as close to the correct time as possible.
I don't think you can really do this accurately enough to get good
sound, but the basic mechanism is time.sleep(t) which takes a floating
point argument. That turns into the appropriate microsleep, I think.
I'm not even sure how to do it from C code with the Linux realtime
scheduler. Traditionally for this sort of thing you'd use dedicated
hardware, or else generate waveforms with a little bit of buffering in
the sound card.
More information about the Python-list
mailing list