<div dir="ltr"><div><div>Hello Juan, Mario<br><br></div>LiCK contains NoteOn/NoteOff/ControlChangeMidiMsg classes that extend MidiMsg and hide some of the details.<br><br><a href="https://github.com/heuermh/lick/tree/master/lick/midi">https://github.com/heuermh/lick/tree/master/lick/midi<br></a><br></div>Here&#39;s an example of how they might be used<br><br><a href="https://github.com/heuermh/lick/blob/master/lick/midi/AnimoogMidi.ck#L104">https://github.com/heuermh/lick/blob/master/lick/midi/AnimoogMidi.ck#L104<br></a><div><br></div><div>Cheers,</div><div><br></div><div>   michael<br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 22, 2018 at 5:41 PM, mario buoninfante <span dir="ltr">&lt;<a href="mailto:mario.buoninfante@gmail.com" target="_blank">mario.buoninfante@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Juan,<br>
<br>
<br>
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&#39;ve almost never used MIDI files. so, honestly I&#39;ve never paid attention to that example, mea culpa :)<br>
<br>
apart from that, now I&#39;d like to know what are the differences between MidiFileIn and MidiRW. I&#39;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&#39;ll try to get the descriptions as well as soon as possible.<br>
<br>
<br>
cheers,<br>
<br>
Mario<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On 22/05/18 22:48, Juan Reyes wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Mario,<br>
<br>
Have used &#39;MidiFileIn&#39; as per  &#39;/examples/midi/<a href="http://playmidi.ck" rel="noreferrer" target="_blank">playmidi.ck</a>&#39;<br>
<br>
Some documentation is on:<br>
[1]  <a href="https://ccrma.stanford.edu/~spencer/ckdoc/io.html#MidiFileIn" rel="noreferrer" target="_blank">https://ccrma.stanford.edu/~sp<wbr>encer/ckdoc/io.html#MidiFileIn</a><br>
<br>
BTW, Thanks to Spencer for MidiFileIn&#39;.<br>
<br>
Tricky parts are more related to MidiMsg and actual midifile<br>
manipulation.  &#39;<a href="http://playmidi.ck" rel="noreferrer" target="_blank">playmidi.ck</a>&#39; only triggers noteOns from the MIDI file.<br>
For NoteOffs another MidiMsg conditional (or filter for this kind of<br>
data stream on file) needs to be added. Tempo can also be manipulated by just hacking &#39;<a href="http://playmidi.ck" rel="noreferrer" target="_blank">playmidi.ck</a>&#39; code.<br>
<br>
Certainly one needs to get fluent on MIDI messaging hexadecimal codes.<br>
NoteOn is 0x90 and NoteOff is 0x80. NoteOffs are useful to get actual<br>
note durations. Some STK Ugens sustain forever if you don&#39;t have<br>
NoteOffs, -in fact wherever an ADSR is not used-.<br>
<br>
Below some code that works to get NoteOffs and for illustration<br>
purposes. Can post all the code or email it, in case you need it.<br>
<br>
Thanks for the MIDI Reference chapter on the ChucK FLOSS manual.<br>
<br>
  -- Juan Reyes<br>
<br>
<br>
//****************************<wbr>******************************<wbr>//<br>
<br>
MidiFileIn min;<br>
MidiMsg msg;<br>
<br>
0 =&gt; int j;<br>
time delta;<br>
float beg;  // start midi note<br>
0.0 =&gt; float durat;<br>
<br>
 if((msg.data1 &amp; 0xF0) == 0x90 &amp;&amp; msg.data2 &gt; 0 &amp;&amp; msg.data3 &gt; 0)<br>
{<br>
&lt;&lt;&lt; j, &quot;  NOTE-ON KEY:  &quot;, msg.data2, &quot;Velocity: &quot;, msg.data3 &gt;&gt;&gt;;<br>
    1 +=&gt; j;<br>
 }<br>
<br>
if((msg.data1 &amp; 0xF0) == 0x80)<br>
 {<br>
   beg-last =&gt; durat;<br>
 &lt;&lt;&lt; &quot;NOTE-OFF:  &quot;,msg.data2, msg.data3, &quot;start: &quot;, beg, &quot;  duration: &quot;,<br>
durat &gt;&gt;&gt;;<br>
<br>
beg =&gt; last;<br>
}<br>
<br>
//****************************<wbr>******************************<wbr>//<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
at the moment there are info about MIDI also under the Event Reference, which I don&#39;t wanna touch for now. anyway, there are a couple of classes I&#39;ve never seen before, MidiMsgIn, MidiMsgOut and MidiFileIn, has anyone ever used them?<br>
<br>
</blockquote></blockquote>
<br>
______________________________<wbr>_________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton<wbr>.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" rel="noreferrer" target="_blank">https://lists.cs.princeton.edu<wbr>/mailman/listinfo/chuck-users</a><br>
</div></div></blockquote></div><br></div>