Hello Juan, Mario LiCK contains NoteOn/NoteOff/ControlChangeMidiMsg classes that extend MidiMsg and hide some of the details.
https://github.com/heuermh/lick/tree/master/lick/midi Here's an example of how they might be used https://github.com/heuermh/lick/blob/master/lick/midi/AnimoogMidi.ck#L104 Cheers, michael On Tue, May 22, 2018 at 5:41 PM, mario buoninfante < mario.buoninfa...@gmail.com> wrote: > Hi Juan, > > > thanks a lot for that. I forgot there was an example about it. despite I > work quite a lot with MIDI in general, from both programming and musical > purposes, I've almost never used MIDI files. so, honestly I've never paid > attention to that example, mea culpa :) > > apart from that, now I'd like to know what are the differences between > MidiFileIn and MidiRW. I'll dig a bit more into the source code. in the > meanwhile I updated the ChucK FLOSS manual, with at least all the methods I > found on the link you sent. I'll try to get the descriptions as well as > soon as possible. > > > cheers, > > Mario > > > > On 22/05/18 22:48, Juan Reyes wrote: > >> 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 >
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users