* Re: Re: [linux-audio-dev] midi events in jack callback / ALSA Sequencer
2002-08-21 1:10 ` Martijn Sipkema
@ 2002-08-21 23:48 ` Frank van de Pol
2002-08-22 10:45 ` Martijn Sipkema
0 siblings, 1 reply; 4+ messages in thread
From: Frank van de Pol @ 2002-08-21 23:48 UTC (permalink / raw)
To: Martijn Sipkema; +Cc: Frank van de Pol, linux-audio-dev, alsa-devel
On Wed, Aug 21, 2002 at 02:10:35AM +0100, Martijn Sipkema wrote:
> [...]
> > Within ALSA we have two priority queues, one for tick (bar,beat) scheduled
> > events, and one for clock (ns) scheduled events.
>
> As MIDI uses MIDI tick messages for time based sync and MIDI clock messages
> for tempo based sync I kind of feel the ALSA sequencer naming is a little
> confusing :)
I understand. OTOH the problem might also be introduced back in the 80's
when MIDI 1.0 spec was introduced. The "MIDI Clock" (0xf8) message was
introduced with only beat sync in mind. I believe the phrase 'tick' to
specify song position came from the standard midi file (SMF 1.0)
specification.
In fact the definitions in seq_event.h are less confusing:
/** Real-time data record */
typedef struct snd_seq_real_time {
unsigned int tv_sec; /**< seconds */
unsigned int tv_nsec; /**< nanoseconds */
} snd_seq_real_time_t;
/** (MIDI) Tick-time data record */
typedef unsigned int snd_seq_tick_time_t;
/** unioned time stamp */
typedef union snd_seq_timestamp {
snd_seq_tick_time_t tick; /**< tick-time */
struct snd_seq_real_time time; /**< real-time */
} snd_seq_timestamp_t;
>
> I don't want to support tempo (MIDI clock) scheduling in my MIDI API. This
> could be better handled in the application itself. Also, when slaved to MIDI
> clock
> it is no longer possible to send messages ahead of time, and not supporting
> this
> in the API makes that clear to the application programmer.
The concept of the public available alsa timing queues allow outboard
applications to schedule events in a tempo locked fashion. Think of
applications like drum machines, appegiators, tempo delay etc. Of course you
might be using one big monolithic (cubase?) sequencer application which does
do everything you need....
Compare it to an external (outboard) drum machine you're using since
programming a pattern in it so user friendly (hence you end up being more
creative), and sync that from your favorite sequencer which has the tempo
map for your song.
Of course all of this could be done without a queue which supports tempo
scheduling, but then you'll need to emit MIDI Clock events and rely on
immediate processing. In case a soft synth (or other potentially high
latency device) is triggered from the MIDI Clock you loose the ability to
correct for this.
[...]
> > Since especially for soft synths (but also for some -undocumented!- USB
> midi
> > interfaces, like Emagic AMT)
>
> Yes, I've repeatedly asked Emagic for documentation on their AMT protocol
> without success. :(
let them burn in peace....
[...]
> > When using events instead of midi bytes the merging is a no brainer
>
> I was planning on doing that, but even then there are issues with for
> example
> (N)RPNs.
>
> > leaves room for events not defined in midi spec).
>
> ...I'm not sure that is a good idea. What kind of events?
eg.
- system events like announcements of topology changes
- (N)RPNs as a 14 bit value instead of 2x 7bit
- SMF like meta data
- controls for current sequencer queue: tempo, position, etc.
to name a few
Cheers,
Frank.
--
+---- --- -- - - - -
| Frank van de Pol -o) A-L-S-A
| FvdPol@home.nl /\\ Sounds good!
| http://www.alsa-project.org _\_v
| Linux - Why use Windows if we have doors available?
-------------------------------------------------------
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: [linux-audio-dev] midi events in jack callback / ALSA Sequencer
2002-08-21 23:48 ` Frank van de Pol
@ 2002-08-22 10:45 ` Martijn Sipkema
0 siblings, 0 replies; 4+ messages in thread
From: Martijn Sipkema @ 2002-08-22 10:45 UTC (permalink / raw)
Cc: Frank van de Pol, linux-audio-dev, alsa-devel
> > I don't want to support tempo (MIDI clock) scheduling in my MIDI API.
This
> > could be better handled in the application itself. Also, when slaved to
MIDI
> > clock
> > it is no longer possible to send messages ahead of time, and not
supporting
> > this
> > in the API makes that clear to the application programmer.
>
> The concept of the public available alsa timing queues allow outboard
> applications to schedule events in a tempo locked fashion. Think of
> applications like drum machines, appegiators, tempo delay etc. Of course
you
> might be using one big monolithic (cubase?) sequencer application which
does
> do everything you need....
No, I like the concept of a lot of small applications. And I want those to
be able
to sync (slave) to MIDI clock.
> Compare it to an external (outboard) drum machine you're using since
> programming a pattern in it so user friendly (hence you end up being more
> creative), and sync that from your favorite sequencer which has the tempo
> map for your song.
For this, the sequencer is master and just sends the MIDI messages including
MIDI clock to a scheduled UST queue. Timing will be as good as is possible
with a MIDI clock slaved external instrument.
> Of course all of this could be done without a queue which supports tempo
> scheduling, but then you'll need to emit MIDI Clock events and rely on
> immediate processing.
Isn't that what will eventually happen using a tempo queue also?
> In case a soft synth (or other potentially high
> latency device) is triggered from the MIDI Clock you loose the ability to
> correct for this.
I don't see how having a MIDI clock scheduled tree will help. When slaving
to MIDI clock you cannot know when a future beat will occur, so a software
synth salved to MIDI clock will behave just like a software synth in real
time,
i.e. it cannot compensate for its own latency. However, if the master sends
the MIDI clock messages ahead of time, and for a sequencer application this
is exactly what it would do, then the software synth can compensate for its
latency and might even interpolate between clocks. This would not be
possible
having a tempo based queue since the UST of the messages in that queue are
not known in advance, right?
> > > leaves room for events not defined in midi spec).
> >
> > ...I'm not sure that is a good idea. What kind of events?
>
> eg.
>
> - system events like announcements of topology changes
I'm thinking of handling these out-of-band.
> - (N)RPNs as a 14 bit value instead of 2x 7bit
This I would like to solve by having the posibility of sending a short
sequence
of MIDI messages that are guaranteed to not be interleaved, e.g. 4 messages,
two for setting the current (N)RPN and 2 for setting its value.
> - SMF like meta data
Is it really necessary to support karaoke :)
> - controls for current sequencer queue: tempo, position, etc.
These aren't needed when a tempo queue isn't used.
I think it is important to keep the API as simple as possible.
--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
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: Re: [linux-audio-dev] midi events in jack callback / ALSA Sequencer
@ 2002-08-22 11:51 mikko.a.helin
2002-08-22 13:21 ` Martijn Sipkema
0 siblings, 1 reply; 4+ messages in thread
From: mikko.a.helin @ 2002-08-22 11:51 UTC (permalink / raw)
To: linux-audio-dev; +Cc: alsa-devel
Why is it important to keep the API simple, shouldn't it be functional in first place and make the API usage simply?
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, 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.
-Mikko
> etc. Of course
> you
> > might be using one big monolithic (cubase?) sequencer
> application which
> does
> > do everything you need....
>
> No, I like the concept of a lot of small applications. And I
> want those to
> be able
> to sync (slave) to MIDI clock.
>
>
> I think it is important to keep the API as simple as possible.
>
> --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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Re: [linux-audio-dev] midi events in jack callback / ALSA Sequencer
2002-08-22 11:51 Re: [linux-audio-dev] midi events in jack callback / ALSA Sequencer mikko.a.helin
@ 2002-08-22 13:21 ` Martijn Sipkema
0 siblings, 0 replies; 4+ messages in thread
From: Martijn Sipkema @ 2002-08-22 13:21 UTC (permalink / raw)
To: linux-audio-dev; +Cc: alsa-devel
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-08-22 12:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-22 11:51 Re: [linux-audio-dev] midi events in jack callback / ALSA Sequencer mikko.a.helin
2002-08-22 13:21 ` Martijn Sipkema
[not found] <Pine.LNX.4.21.0208191748480.673-100000@summer.quitte>
[not found] ` <002001c247ac$2259e960$0400a8c0@martijn>
2002-08-20 20:50 ` Frank van de Pol
2002-08-21 1:10 ` Martijn Sipkema
2002-08-21 23:48 ` Frank van de Pol
2002-08-22 10:45 ` Martijn Sipkema
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.