Real time event accuracy

T

Tobiah

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'd also appreciate suggestions and pointers to a
suitable python MIDI library, and maybe an outline
of what must be done to get the MIDI events to
the other program's MIDI in.

Thanks,

Tobiah
 
P

Paul Rubin

Tobiah said:
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.
 
T

Tobiah

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 think the time would have to come from a hardware clock.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top