[music-dsp] implementing sequencer...
Miracle Band
miracle_band at hotbox.ru
Thu Apr 18 06:41:13 EDT 2002
Hello, I'm writing sequencer now. two years ago I've written a tracker and
I've found two methods in this field... It's about audio sequencer...
1) You can use buffered seq.. With the same event buffer length as the audio
streaming buffer.. and your seq will process events data while processing
(mixing) audiodata byte by byte. Without using the clock, using only Audio
driver messages.
2a) You can use multimedia clock (the best method for MIDI) with callback
function. This clock will call your function after some milliseconds. Use
timeSetEvent windows function and so on. This method is similar to using of
deltas between events.
2b) You can use some clock sync thread and poll system clock data. It will
cost you some CPU resources... I think, this may be about 7%.
If you're programming MIDI seq, I recommend you (2a) algo.
Anyway, I need more information to give a piece of advice.
SY, Miracle.
> I was wondering if anyone had tips for writing a sequencer. Here's where
> I'm thinking now:
>
> - sleep and usleep aren't reliable to sync the event stream to, when I use
> these the timing goes to pieces. obviously I'm going to need to watch the
> system clock and sync to it rather than rely on usleep deltas between
> sequencer events...
>
> - so now, I am considering using cycle counter, or possibly gettimeofday
> (system clock) without any yield or sleep. I'm afraid this might
> consume too much of the CPU though... For example, I may want to run some
> graphics at the same time as the music (the music may be softsynth or
> midi)... I'm a little afraid of latency issues on either the music or
> graphics side.
>
> Anyway, I was wondering what all of you do to implement your sequencers?
> I'd be especially interested how you load-balance between graphics and
> music sequencing. And any tips on how to keep the music "with the clock".
>
dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/
More information about the music-dsp
mailing list