[Coco] Musical MIDI File player for the Coco

KnudsenMJ at aol.com KnudsenMJ at aol.com
Sat Mar 5 20:23:15 EST 2005


In a message dated 2/16/05 1:29:50 PM Eastern Standard Time,  
alsplace at pobox.com writes:

>How  did you pull that off?!
>Remember ... Paul Seniura (sp?) or something,  who was working very hard 
>on doing CoCo MIDI stuff?  Seems he had  a converter that would take a 
>Type 0 (is that the one all laid out  track by track, easier to parse?) 
>and then convert it to something the  CoCo could play.  I thought there 
>were a lot of issues preventing  it from really being done -- maybe the 
>lack of a good  timer.
>What did you do to make it work?
Hmmm ... I checked, and I don't seem to have answered this  email.
 
Yes, Paul Seniura had a two- or three-stage process for playing MIDI on the  
Coco.  If you had a Format 1 file, you first ran one of his programs to  make 
it into Format 0.  Then, another program "compiled" it into his own  
fast-playing binary format.  At this stage, you could specify instrument  changes and 
other alterations.   Finally, you ran his player.
 
In Format 0 all the musical events are mixed together, sorted by time --  
easy to play.
Format 1 has one "track" after another, each sorted from time=0.  To  play 
it, you need all the tracks in RAM at once.
 
Paul spent a lot of time either tinkering with the horizontal retrace  
interrupt in the GIME, or trying to talk others into doing the R&D on  that.  He 
felt that such precise timing was needed to play music.
 
But, from UME, I knew that the OS-9 clock, running at a mere 60 Hz, was  good 
enough.  The trick I pulled was to compute "sleep" times in not just  
integral clock ticks, but in fractions (64ths or maybe 256ths) of clock ticks),  wait 
the integral number, but carry over the fractional residue from one sleep  to 
another (one note/chord to another).
 
That way I avoid any cumulative errors.  Every sleep() is a fraction  of a 
tick too short, but sooner or later a sleep() waits an extra tick as the  
residue fraction builds up.
 
I explained this to Paul in email, and shortly thereafter he came out with  a 
player that did the same thing.  He explained how it worked, without  
mentioning my name (thanks).
 
Anyway, my Coco/MM1 MIDI player works on Format 0 or 1 without any  
pre-processing, but if the file won't fit in RAM it won't all get played.   I could 
throw some of my virtual memory tricks at it, but I'm not sure if the 8K  blocks 
can be swapped in and out fast enough in a Format 1 file.
 
Oh yes, I also keep track of the Coco's internal clock, to make sure I  don't 
miss a tick.  I use very dirty tricks to read it, without the  hideously slow 
F$CopyMem (which itself eats a whole tick!).   --Mike  K.
 
 

 



More information about the Coco mailing list