Re: of timestamps & midi packets
Re: of timestamps & midi packets
- Subject: Re: of timestamps & midi packets
- From: Roy Lovejoy <email@hidden>
- Date: Thu, 31 Jul 2003 13:36:39 -0700
On Thursday, July 31, 2003, at 12:07 PM, Zico Kolter wrote:
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.
I was already parsing the midi file prior to the MusicPlayer detour, so
all the tracks are totally 'digested'.
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
That much I understand from my fun days of Audio/Video streaming..
(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).
I batch process prior, but I stamp *immediately* on the way out.
All together, this is a total pain,
no argument there.
and given the fact that the MusicPlayer
APIs do all this for you, it just doesn't seem worth it.
Oh, I had the MusicPlayer API's humming along swimmingly. Worked great..
Then the contract requirement shifts came..
Need to mute/solo any note. (no problem with with the event iterator
stuff, granted)
Need to muck with any note, in a manner TO BE DETERMINED.
Need to play with tempo.
Need to have 'fake midi out' (i.e. use internal synth library) for OS 9.
So what started out as a strong candidate to treat the .mid file as a
black box,
using MusicPlayer, turned into having to muck with the data, in a way
that had to run on 9 & X..
So I had to go back to parsing the .mid & sending through MIDISend().
I'd really
recommend trying to fix whatever problems you're having the
MusicPlayer APIs
before you jump into these other problems.
No problems using MP API's.. Now I have to do 95% of what MusicPlayer
does for me,
on 9 & X.
Of course, you might have your
own reason for needing to do it this way, and in that case, good luck
:-).
_______________________________________________
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.