Subject: [linux-audio-dev] Sequencers & scheduling
From: Paul Winkler (slinkp_AT_ulster.net)
Date: ma tammi 10 2000 - 03:18:34 EST
Hi audio-dev people,
I have a question for anyone who's designed a sequencer with tempo
controls:
How do you handle the timing of events in the output?
I can think of only two general approaches:
1) Schedule each event using the system clock, taking into account
currently known tempo changes.
ADVANTAGE: Probably pretty accurate timing.
DISADVANTAGE: No way to change the scheduling of an event
once it's been scheduled. If, for instance, an
interactive tempo control is modified in the mean-
time, we're screwed... all previously scheduled
events won't know about the change.
I would love to find out I'm wrong about this.
-OR-
2) Instead of scheduling events, merge them into a sorted queue of
events, each of which has a start time (in beats) associated with
it. At a fixed interval (e.g. once every 0.5 milliseconds?), we
advance the beat clock by an amount determined by the current tempo,
and then check the queue to see if the soonest event is supposed to
happen yet (or if it's already late). If so, pop events off the
queue and send them to the output stream until we find one that's
not supposed to happen yet.
ADVANTAGE: This can work with BOTH pre-set tempo curves AND
realtime interactive tempo control; these just affect the
beat clock.
DISADVANTAGE: Timing is not so accurate, suffering from
jitter. A very, very small interval between updates would
help but may not be practical. This is like csound's timing
problem - time cannot be controlled with more
than ksmps precision.
Probably this is not critical in most situations, but
it's certainly not optimal.
Comments?
I ask because I'm doing some heavy re-designing of pysco, as I mull
over how I can use it for both realtime interactive work (probably
with various GUIs) and for non-realtime score generation.
I'm also working on how to handle nested events (I think I've got
that licked).
-- ................ paul winkler .................. slinkP arts: music, sound, illustration, design, etc. A member of ARMS -----> http://www.reacharms.com or http://www.mp3.com/arms or http://www.amp3.net/arms personal page ----> http://www.ulster.net/~abigoo
This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:23:26 EST