Midi and Revolution

Mark Smith mark at maseurope.net
Sat Dec 16 20:42:59 EST 2006


> 1) I need a midi file to trigger events in Revolution. Is putting  
> the midi file into a player and then using callbacks the only way?  
> If so, is there some formula where I can tell exactly what callback  
> number is associated with what note? I am trying to figure it out  
> using tempo in the midi file and timescale in the player. So if  
> tempo is 60 beats per minute and the timescale of the player is  
> 600, then at the end of the 60th beat, a minute should have passed  
> and therefore the callback number would be 600 * 60 or 36000, but  
> it isn't working out that perfectly. Maybe tempo in midi or  
> callbacks in Revolution are not entirely exact?

How accurate do you need this to be?
I'd imagine the quicktime midi player to be decently accurate in it's  
timing, so I'd think the inaccuracies you're seeing are more likely  
to be with the callback mechanism.

> 3) Is it always a midi FILE that has to play? One thing I need is a  
> click that plays endlessly at a specific tempo. I am creating the  
> click by making a midi file that uses one of the Drum instruments.  
> But of course the file runs out eventually and I have to loop it  
> and there is inevitably a jerk. Is there any way to not use a file  
> at all and just play a note over and over at a certain tempo? (I  
> know I could just skip midi altogether and play a tiny sound file  
> over and over, but I'd like to stick to midi for some other reasons.)


It's fairly easy to use the 'beep' command to make a reasonably  
consistent click, using 'send in time'. Alternatively, you could make  
a looping sound file, and use the 'playRate' to adjust the tempo.

> is there some formula where I can tell exactly what callback number  
> is associated with what note?

I don't know if you can get at individual midi events (such as notes)  
using callbacks, though I doubt it. Again, depending on how accurate  
you need it to be, you might be able to actually parse the midi file,  
and trigger events at the right time, again, using 'send in time'.

I've not played around with midi files (though I've used midi a great  
deal), but I'd imagine something like this would be doable.
If you need millisecond accuracy, though, I doubt that this would be  
good enough.

Best,

Mark


On 16 Dec 2006, at 16:13, Fred Moyer wrote:

> This is for anyone who knows about midi:
>
> 1) I need a midi file to trigger events in Revolution. Is putting  
> the midi file into a player and then using callbacks the only way?  
> If so, is there some formula where I can tell exactly what callback  
> number is associated with what note? I am trying to figure it out  
> using tempo in the midi file and timescale in the player. So if  
> tempo is 60 beats per minute and the timescale of the player is  
> 600, then at the end of the 60th beat, a minute should have passed  
> and therefore the callback number would be 600 * 60 or 36000, but  
> it isn't working out that perfectly. Maybe tempo in midi or  
> callbacks in Revolution are not entirely exact?
>
> 2) Running midi in a player burns up the cpu. Just having a tiny  
> 20K midi file in the player and not even playing spikes up  
> Revolution's use of the cpu to 35% in Activity Monitor, the Apple  
> applications in the Utilities folder. Then playing the midi file is  
> also more intensive on the cpu than playing a sound file. The app  
> that I am writing will be used with a laptop, often on battery  
> power, so this is a crucial issue. What is the cpu doing with a  
> dormant midi file that is so difficult and crucial so as to use 35%  
> of the cpu? Is this a Quicktime bug, Revolution bug?
>
> 3) Is it always a midi FILE that has to play? One thing I need is a  
> click that plays endlessly at a specific tempo. I am creating the  
> click by making a midi file that uses one of the Drum instruments.  
> But of course the file runs out eventually and I have to loop it  
> and there is inevitably a jerk. Is there any way to not use a file  
> at all and just play a note over and over at a certain tempo? (I  
> know I could just skip midi altogether and play a tiny sound file  
> over and over, but I'd like to stick to midi for some other reasons.)
>
> 4) I know very little about midi. Is there anyone out there who  
> could help me with my project?
>
> Thanks
> Fred Moyer
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list