Hi Mario,

Have used 'MidiFileIn' as per  '/examples/midi/playmidi.ck'

Some documentation is on:
[1]  https://ccrma.stanford.edu/~spencer/ckdoc/io.html#MidiFileIn

BTW, Thanks to Spencer for MidiFileIn'.

Tricky parts are more related to MidiMsg and actual midifile
manipulation.  'playmidi.ck' only triggers noteOns from the MIDI file.
For NoteOffs another MidiMsg conditional (or filter for this kind of
data stream on file) needs to be added. Tempo can also be manipulated by just hacking 'playmidi.ck' code.

Certainly one needs to get fluent on MIDI messaging hexadecimal codes.
NoteOn is 0x90 and NoteOff is 0x80. NoteOffs are useful to get actual
note durations. Some STK Ugens sustain forever if you don't have
NoteOffs, -in fact wherever an ADSR is not used-.

Below some code that works to get NoteOffs and for illustration
purposes. Can post all the code or email it, in case you need it.

Thanks for the MIDI Reference chapter on the ChucK FLOSS manual.

  -- Juan Reyes


//**********************************************************//

MidiFileIn min;
MidiMsg msg;

0 => int j;
time delta;
float beg;  // start midi note
0.0 => float durat;

 if((msg.data1 & 0xF0) == 0x90 && msg.data2 > 0 && msg.data3 > 0)
{
<<< j, "  NOTE-ON KEY:  ", msg.data2, "Velocity: ", msg.data3 >>>;              
          
        1 +=> j;
 }
                
if((msg.data1 & 0xF0) == 0x80)
 {
   beg-last => durat;
 <<< "NOTE-OFF:  ",msg.data2, msg.data3, "start: ", beg, "  duration: ",
durat >>>;

beg => last;
}

//**********************************************************//



at the moment there are info about MIDI also under the Event Reference, which I don't wanna touch for now. anyway, there are a couple of classes I've never seen before, MidiMsgIn, MidiMsgOut and MidiFileIn, has anyone ever used them?

_______________________________________________
chuck-users mailing list
chuck-users@lists.cs.princeton.edu
https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

Reply via email to