[alsa-devel] [LAD] How to get correct midi timings from ALSA using the library only

Carlo Florendo subscribermail at gmail.com
Thu Jul 26 06:51:25 CEST 2007

Florian Schmidt wrote:
> Another approach, that works very well in my experience, is to not sleep the 
> total required time until the next event, but rather regularly sleep for very 
> short amounts of time (< 1ms), wakeup, measure the current time and if any 
> event time now lies in the past, simply play it back immediately. This way 
> the sleep time doesn't need to be accurate at all. All that's needed is that 
> it's small enough to get some decent timing.

I've now finished implementing this approach, sleeping around 10000 
microseconds instead of  less than 1ms, and it works very well!  Thanks!

I'm getting very decent timing even with complicated MIDI files that have 
numerous pitch bends at very short times.

I'm about to try your other suggestions later on.

Thank you very much.

> Regards,
> Flo

Best Regards,


Carlo Florendo
Softare Engineer/Network Co-Administrator
Astra Philippines Inc.
UP-Ayala Technopark, Diliman 1101, Quezon City

The Astra Group of Companies
5-3-11 Sekido, Tama City
Tokyo 206-0011, Japan

More information about the Alsa-devel mailing list