[linux-audio-dev] Audio/Midi system - RT prios..

Chris Cannam chris.cannam at ferventsoftware.com
Fri Dec 30 15:17:04 UTC 2005

Florian Schmidt writes:
> I further assume that the alsa seq event system
> is used 

This is true of Rosegarden,

> and midi events are not queued
> for future delivery but always delivered immediately.

but this isn't -- Rosegarden always queues events 
from a non-RT thread and lets the ALSA sequencer
kernel layer deliver them.  (Thru events are delivered 
directly, with potential additional latency because of
the lower priority used for the MIDI thread.)  In
principle this should mean that only the priority of
the receiving synth's MIDI thread is significant for 
the timing of sequenced events.  We also have a 
mechanism to compensate for gradual drift between 
the MIDI timing source (kernel timers or RTC) and 
soundcard clock, when synchronising to audio, by 
adjusting the sequencer skew factor.  (This happens 
to be similar to the mechanism for slaving to MTC, 
which is handy.)

In my experience this is all a long way from 
foolproof.  The most common problems for users 
seem to be:

 - ALSA sequencer uses kernel timers by default and 
of course they only run at 100 or 250Hz in many 

 - ALSA sequencer can sync to RTC, but the 
associated module (snd-rtctimer) appears to hang 
some kernels solid when loaded or used.  I don't have 
much information about that, but I can probably find 
out some more.

 - ALSA sequencer can sync to a soundcard clock, 
but this induces jitter when used with JACK and has 
caused confusion for users who find themselves 
inadvertently sync'd to an unused soundcard (the
classic "first note plays, then nothing" symptom). 

The biggest advantage of course is not having to run 
an RT MIDI timing thread.  My impression is that this 
aspect of MusE (which does that, I think) causes 
as many configuration problems for its users as using 
ALSA sequencer queue timers does for Rosegarden's.  

Any more thoughts on this?


More information about the Linux-audio-dev mailing list