RE: MIDI processing question
RE: MIDI processing question
- Subject: RE: MIDI processing question
- From: "Steve Schow" <email@hidden>
- Date: Fri, 2 Apr 2004 10:55:15 -0800
- Organization: Backstage Productions
The MOTU MidiTimePiece (which is the device that started this thread)
includes hardware level midi timestamping. Which means, presuming the
driver is doing what its supposed to, that the actual hardware is
timestamping the midi events, not CoreMidi, not your application. I believe
that if you are using a different midi interface that does not include
timestamping, then either CoreMidi or the device driver (I'm not sure which
but I would guess the device driver) would be providing the timestamp.
I agree, some older apps that were not written originally around the
CoreMidi paradigm may supply their own timestamps. But anything written
around CoreMidi from the ground up should in fact be using the timestamp
that is already present in the event from the moment the app first gets
it(generated in CoreMidi, device driver or hardware).
Regarding the original question about the ordering..that's a strange one.
Its hard for me to believe that the Motu MTP would output the events in
random order different from the timestamps because those interfaces are
designed to work on OS9 (no CoreMidi), PC's, etc.. There are plenty of
situations where the hardware-generated timestamp would be completely
ignored in the host app, so I would think they would make the interface
reliable in those situations, even though the original timestamp intention
was to take advantage of hardware timestamping only in DP.
But who knows...maybe when they made the OSX CoreMidi driver they decided
the order was not relevant any more since the timestamp has the relevant
information and the host app should be able to take the incoming events and
put them where they need to be. That would be lame though. I would like to
hear from more people that are experiencing this so we can bug MOTU about
it.
>
Note that the timestamps are set by the code that creates the whole
>
MIDI packet and gives it to the MIDIServer. As far as I know, the
>
MIDIServer does very little (perhaps no) processing of the timestamps
>
-- it just passes the packets through. So you're at the mercy of
>
whoever's generating the MIDI data -- either a MIDI driver or another
>
application.
>
>
Also, I wouldn't be surprised if some applications ignore the
>
timestamps on incoming MIDI data, and instead make their own
>
timestamps
>
(based on the current host time when they receive the
>
packets). These
>
apps would appear to work, even if the driver-generated
>
timestamps were
>
wrong. I wouldn't *recommend* that anyone ignore the
>
timestamps, since
>
it means throwing away one of the primary advantages of CoreMIDI, but
>
it wouldn't amaze me if people actually do (since the
>
difference could
>
be fairly subtle, especially on a fast and lightly-loaded machine).
>
>
> HOWEVER, what I am _experiencing_ is that I am in fact recieving
>
> events in the MIDIPacketList sometimes in ascending order and
>
> sometimes in descending, and I *guess* I will someday maybe
>
get some
>
> in an arbitrary order.
>
>
I haven't seen this before, but I guess there's a first time for
>
everything. Seems like there are two possibilities:
>
>
1) The packets (and the data in the packets) are in the right order,
>
but the timestamps are just wrong. Are the timestamps
>
reasonably close
>
to the value you get from AudioGetCurrentHostTime()? They should be.
>
>
2) The timestamps for each packet are correct, but the packets are
>
getting put into MIDIPacketLists in the wrong order, or perhaps
>
delivered in the wrong order.
>
>
If you send some MIDI data, do you get it back in the same
>
order? (Run
>
a cable from an output of your MIDI interface back to an input on the
>
same interface, send out some MIDI data, and see what you get back.)
>
>
> some colleagues are of the opinion that because this seems to only
>
> happen with one particular driver (at the moment) that the driver
>
> "sucks" and there's not alot we can do about it. *HOWEVER* I
>
> personally am of the opinion that since the documentation
>
is not 100%
>
> comprehensive it is a better idea to field the issue here in this
>
> forum, because maybe on the other side of the sargasso they
>
are saying
>
> that those music apps "suck" because they don't sort their incoming
>
> MIDI ...
>
>
I see your point. I don't know of any documentation that explicitly
>
answers this question. However, I can't think of any reasons why
>
allowing out-of-order packets would be a good idea. So that leads me
>
to think that it was just too obvious for anyone to remember to
>
document!
>
>
(But of course, I'm always happy to be proved wrong.)
>
>
--
>
Kurt Revis
>
email@hidden _______________________________________________
>
coreaudio-api mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/co> reaudio-api
>
Do
>
not post admin requests to the list. They
>
will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.