[chuck-users] trying to implement a midi sequencer in chuck

d dchuck at yurfish.com
Fri Feb 11 15:33:37 EST 2022


Hi,

I am trying to implement a midi
sequencer in chuck  and aparrently
do not understand how time is
advanced.

The script below works fine for
one track midi files but
more than than and, it seems like
events get lost.

I tried  something similar. where
I used multiple files and that
worked, except there is no way
to pass the filename, etc  from
a driver file so Id have to
wrap it in a shell script

any suggestions appreciated.

davud

---midisequencer.ck--------------
MidiFileIn min;
MidiOut mout;
MidiMsg msg;
int done;
string filename;
me.arg(0) => filename;
if( !min.open(filename) ){
   <<< "unable to open MIDI file:'",filename >>>;
    me.exit();
}
mout.open(0);
for( int t; t < min.numTracks(); t++ )
     spork ~ track(t );
     
while( done < min.numTracks() )
    1::second => now;

function void  track(int a) {
    while( min.read(msg,a))
    {
       <<<msg.when>>>;
        msg.when=> now;  
         mout.send(msg);
   }
    done++;
}


More information about the chuck-users mailing list