Re: of timestamps & midi packets
Re: of timestamps & midi packets
- Subject: Re: of timestamps & midi packets
- From: Zico Kolter <email@hidden>
- Date: Thu, 31 Jul 2003 15:07:34 -0400
On Thursday 31 July 2003 2:28 pm, Roy Lovejoy wrote:
>
thanks for the informative response..
>
>
On Thursday, July 31, 2003, at 11:06 AM, Philippe Wicker wrote:
>
> To determine the actual value of this clock tick call
>
> AudioGetHostClockFrequency().
>
>
would anyone happen to have a snippet of source that would convert the
>
time values found in a .mid file
>
to MIDITimeStamp, handy?
Oof, as far as I know, there's no easy way of doing this. Times values in a
MIDI file are stored in terms of ticks. So you have to parse the meta events
in the midi file to find 1) the number of ticks per quarter note, which is
usually 480, and 2) the tempo in BPM. Using these values, you can convert
the time values into seconds, or milliseconds or whatever, and then you can
use the audio time routines to convert these into the host clock time values.
But also make sure to remember that MIDITimeStamps will be processed relative
to the current time, so you'll have to set the timestamps not relative to
whatever the current time is when you read the data, but relative to whenever
you think you're going to actually send the data to the MIDI device (this
would only be a problem if you try to batch process the file before sending
it, but it sounds like this is what you're trying to do).
All together, this is a total pain, and given the fact that the MusicPlayer
APIs do all this for you, it just doesn't seem worth it. I'd really
recommend trying to fix whatever problems you're having the MusicPlayer APIs
before you jump into these other problems. Of course, you might have your
own reaosn for needing to do it this way, and in that case, good luck :-).
Zico Kolter
_______________________________________________
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.