RE: [Alsa-devel] Re: [linux-audio-dev] midi events in jack callback / ALSA Sequencer

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: RE: [Alsa-devel] Re: [linux-audio-dev] midi events in jack callback / ALSA Sequencer
From: mikko.a.helin_AT_nokia.com
Date: Fri Aug 23 2002 - 12:10:06 EEST


Ok,
After reading the previous thread on app intercommunication issues I see what kind of MIDI API you are after and why the UST is important. I still think that audio clock would be best solution even though OS doesn't support scheluding on it - you can always use a solution like Paul suggested for JACK MIDI clients (delayed write). What I was thinking was something which may not work on Linux but what I used when I wrote my first simple DOS MIDI sequencer. In Linux it would be some kind of MIDI daemon which reads the timestamped MIDI data from FIFO buffers (one for each client) and compares the timestamps to current time (based to audio clock) and sends out all events for which the time <= current time. If there are no event the thread should sleep for a while or wait for an event from queueing process. Also if the events are queued from JACK callback there are events only for next audio frame (queued at least one frame earlier than consumed by the daemon). Anyway, there may !
be needs for UST (with video) but these days most sequencers handle both audio and MIDI events though there may be users that mostly use only the audio features and need MIDI only for synchronizing (MTC) or FX.
-Mikko

> -----Original Message-----
> From: ext Martijn Sipkema [mailto:msipkema_AT_sipkema-digital.com]
> Sent: 22. August 2002 16:21
> To: linux-audio-dev_AT_music.columbia.edu
> Cc: alsa-devel_AT_alsa-project.org
> Subject: Re: [Alsa-devel] Re: [linux-audio-dev] midi events in jack
> callback / ALSA Sequencer
>
>
> > Why is it important to keep the API simple, shouldn't it be
> functional in
> first place and make the API usage simply?
>
> Who says a simple API can't be functional?
>
> > Anyway (IMHO), there should really be an API which combines
> audio and MIDI
> playback, recording and timing of events and makes it
> possible to keep MIDI
> in sync with audio (ALSA sequencer API seems to support only
> tick and time
> synchronization modes, no audio clock sync mode).
> Professional API's like
> ASIO and VST (and DirectMusic) synchronizes everything to audio clock
> (sample position). Even when MTC is used the audio clock is
> the main clock
> source, digital I/O or world clock is used to sync the audio
> clock to the
> audio clock of the external device. There is no need for
> other sync modes
> than audio (_maybe the tick mode could be useful if ALSA takes care of
> sending MIDI clock, SPP, MTC etc. data to external devices). Sequencer
> application can easily convert sample position from the
> beginning of the
> song to measures / beats, time etc. whatever is needed when the time
> signature, tempo and sample rate is known - reading the
> sample position from
> the sound card is no problem at all!
>
> Well, I disagree. I think using UST is better. You might want
> to use MIDI
> without audio. Also
> MIDI hardware that supports scheduling will not support
> scheduling to the
> audio position. Using
> UST just means mapping different clocks to one common clock.
>
> > , PCI chipset's DMA registers have usually such current
> play position
> register, or if not, the sample position can be calculated by
> measuring the
> time between IRQ's and calculating the time between current
> time and the
> time when last interrupt was received.
>
> The current sample position does not tell me anything about when some
> earlier sample occured or
> a later sample will occur. In your example you already use two UST/MSC
> values to estimate
> the current MSC. Allthough it is possible on some hardware to read the
> current sample position
> (MSC) it is not possible to the OS (or other hardware) to
> schedule on it and
> so you'll have to
> convert to another clock at some point.
>
> --martijn
>
>
>
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: OSDN - Tired of that same old
> cell phone? Get a new here for FREE!
> https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel_AT_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel
>


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Aug 23 2002 - 12:09:35 EEST