Whoops...<div><br></div><div>I figured out 1 thing I was doing wrong... this start and stop code specified mm:on which was a mistake, it should be this:</div><div><br></div><div><div>;to begin recording:</div><div>begin</div>
<div> variable incoming-midi = {}</div><div> variable first-note-time = #f</div><div> send(&quot;mp:receive&quot;, midi-recorder)</div><div>end</div><div><br></div><div>;to stop the recording</div><div>send(&quot;mp:receive&quot;, #f)</div>
</div><div><br><div class="gmail_quote">On Fri, Dec 16, 2011 at 10:49 PM, Landspeedrecord <span dir="ltr">&lt;<a href="mailto:landspeedrecord@gmail.com">landspeedrecord@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,<div><br></div><div>I think I have a bit of midi-recording code working in SAL... But the values I am getting for the time seem wrong, in particular the very first time recorded is a really weird incredibly small number instead of just being 0.</div>

<div><br></div><div>Any help is appreciated, or if there is cleaner or better way that would be even better.  Here is my code so far:</div><div><br></div><div><div>variable incoming-midi = {}</div><div>variable first-note-time = #f</div>

<div><br></div><div>function midi-recorder (mididata)</div><div>  begin </div><div>    with current = now(),</div><div>         opcode = first(mididata),</div><div>         channel = second(mididata),</div><div>         keynum = third(mididata),       </div>

<div>         velocity = fourth(mididata)</div><div>    if (! first-note-time) </div><div>      set first-note-time = current, current = 0</div><div>    else </div><div>      set current = (current - first-note-time)</div>

<div>    set incoming-midi &amp;= list(current, opcode, channel, keynum, velocity)</div><div>    end</div><div>  end</div><div>end</div><div><br></div><div><br></div><div>;to begin recording:</div><div>begin</div><div> variable incoming-midi = {}</div>

<div> variable first-note-time = #f</div><div> send(&quot;mp:receive&quot;, mm:on, midi-recorder)</div><div>end</div><div><br></div><div>;to stop the recording</div><div>send(&quot;mp:receive&quot;, mm:on, #f)</div><div>
<br>
</div><div>And here is an example of what got recorded into the global variable (&quot;incoming-midi&quot;) after a test run using a midi file created from the reich tutorial example:</div><div><div>{{4.3472355173435e-005 9 0 64 63} {0.86995516913521 9 0 66 63} {0.87000498120688 9 0 66 63} {0.87003215142977 9 0 71 63} {0.87007109541264 9 0 71 63} {0.87009781279812 9 0 73 63} {0.87015079472985 9 0 73 63} {0.87018068197176 9 0 74 63} {0.87021781461044 9 0 74 63} {0.8702449848297 9 0 66 63} {0.87029162704494 9 0 66 63} {0.8703192501016 9 0 64 63} {0.87035592990287 9 0 64 63} {0.87038445863436 9 0 73 63} {0.87042113843199 9 0 73 63} {0.87044740298006 9 0 71 63} {0.87048453561692 9 0 71 63} {0.87051080016317 9 0 66 63} {0.87054793280004 9 0 66 63} {1.2680038943981 9 0 74 63} {1.268050989449 9 0 74 63} {1.2680808766945 9 0 73 63} {1.2681343114618 9 0 73 63} {1.2682103880816 9 0 64 63} {1.2682579359698 9 0 64 63} {1.2682783136352 9 0 66 63} {1.2683104650641 9 0 66 63} {1.2683322012417 9 0 71 63} {1.2683638998333 9 0 71 63} {1.2683860888465 9 0 73 63} {1.2684182402754 9 0 73 63} {1.268439976453 9 0 74 63} {1.2684725807194 9 0 74 63} {1.2684943168952 9 0 66 63} {1.2685260154867 9 0 66 63} {1.2685477516661 9 0 64 63} {1.6363184349957 9 0 64 63} {1.6363383598236 9 0 73 63} {1.6363859077119 9 0 73 63} {1.6364185119783 9 0 71 63} {1.6366259113347 9 0 71 63} {1.6366530815576 9 0 66 63} {1.6367001766066 9 0 66 63} {1.6367309695252 9 0 74 63} {1.6367776117386 9 0 74 63} {1.6368097631675 9 0 73 63} {1.8736562061313 9 0 73 63} {1.8736820178437 9 0 64 63} {1.8737300185676 9 0 64 63} {1.8737617171573 9 0 66 63} {1.8738119820682 9 0 66 63} {1.8738445863346 9 0 71 63} {1.8738894172002 9 0 71 63} {2.0213331521991 9 0 73 63} {2.0213829642726 9 0 73 63} {2.0214101344936 9 0 74 63} {2.021451795501 9 0 74 63} {2.1085146945625 9 0 66 63} {2.1085577140784 9 0 66 63} {2.1509378254777 9 0 64 63} {2.1825856994074 9 0 64 63} {2.2213720961827 9 0 73 63} {2.2673853190245 9 0 73 63} {2.3044518407823 9 0 71 63} {2.3515957976742 9 0 71 63} {2.387618077255 9 0 66 63} {2.4386953765352 9 0 66 63} {2.4715867409323 9 0 74 63} {2.5225698501126 9 0 74 63} {2.5556355567642 9 0 73 63} {2.6074994339542 9 0 73 63} {2.6385549970582 9 0 64 63} {2.6925666802526 9 0 64 63} {2.7229207988057 9 0 66 63} {2.7776004166099 9 0 66 63} {2.8049295838427 9 0 71 63} {2.8623878096278 9 0 71 63} {2.8909908074093 9 0 73 63} {2.9475401892869 9 0 73 63} {2.9730715935348 9 0 74 63} {3.0325182266915 9 0 74 63} {3.0595693519899 9 0 66 63} {3.1184879771772 9 0 66 63} {3.1458429561208 9 0 64 63} {3.2025567178371 9 0 64 63} {3.2284268441799 9 0 73 63} {3.287489924378 9 0 73 63} {3.3141271566365 9 0 71 63} {3.3714735316771 9 0 71 63} {3.3980025358869 9 0 66 63} {3.4577444187835 9 0 66 63} {3.484926413983 9 0 74 63} {3.5425426798902 9 0 74 63} {3.5707888420966 9 0 73 63} {3.6366508173705 9 0 73 63} {3.654834035231 9 0 64 63} {3.712540415705 9 0 64 63} {3.739727844948 9 0 66 63} {3.7975338495671 9 0 66 63} {3.8253167594994 9 0 71 63} {3.882491056469 9 0 71 63} {3.909039532673 9 0 73 63} {3.9675098492062 9 0 73 63} {3.9950120001813 9 0 74 63} {4.051609835622 9 0 74 63} {4.0781465380605 9 0 66 63} {4.1374609428076 9 0 66 63} {4.1554195535045 9 0 64 63} {4.2225367930096 9 0 64 63} {4.2505728388369 9 0 73 63} {4.3077548340352 9 0 73 63} {4.3354114024369 9 0 71 63} {4.3916216093821 9 0 66 63} {4.8541221754294 9 0 71 63}}</div>

</div><div><br></div><div><br></div><div>Thanks,<br>Charles</div><div><br></div><div><br></div><br><div class="gmail_quote"><div class="im">On Tue, Dec 13, 2011 at 10:57 AM, Heinrich Taube <span dir="ltr">&lt;<a href="mailto:taube@illinois.edu" target="_blank">taube@illinois.edu</a>&gt;</span> wrote:<br>

</div><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">im sorry its taking so long to get to this.  you are correct you use a hook and push data onto a &quot;recoding list&quot; .<br>


if you cant get this going i&#39;ll send a demo out early next week once the end-of-semester madness is over!<br>
--rick<div><div><br>
<br>
<br>
On Dec 6, 2011, at 9:17 PM, Landspeedrecord wrote:<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
Hi,<br>
<br>
I have a newbie question...<br>
<br>
I am looking to record midi input to grace...  I am guessing by the &quot;input hooks&quot; sal tutorial that this is done by defining a midi receiver (call it &quot;myrecorder&quot;) and then running it with a send(&quot;mp:receive&quot;, myrecorder) command.  I was hoping someone already had some code created to do it... If not, having &quot;myrecorder&quot; shove the midi note information into a list isn&#39;t difficult and I suppose each note on or note off can be paired with the output of a call to the now() function... Is there a better method?<br>


<br>
In related matters, is there a way to exchange midi tempo and other information between a DAW and Grace (besides using OSC)?  I am on a PC for what it is worth.<br>
<br>
Thanks,<br>
Charles<br></div></div>
______________________________<u></u>_________________<br>
Cmdist mailing list<br>
<a href="mailto:Cmdist@ccrma.stanford.edu" target="_blank">Cmdist@ccrma.stanford.edu</a><br>
<a href="http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist" target="_blank">http://ccrma-mail.stanford.<u></u>edu/mailman/listinfo/cmdist</a><br>
</blockquote>
<br>
</blockquote></div></div></div><br><br clear="all"><div class="im"><div><br></div>-- <br><p><a href="http://en.wikipedia.org/wiki/Reality" target="_blank">Reality</a> is the original Rorschach. Verily! So much for all that.</p>


<div>—Malaclypse the Younger, <cite><i>Principia Discordia</i>, Pages 00049–00050</cite></div><br>
</div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><p><a href="http://en.wikipedia.org/wiki/Reality" target="_blank">Reality</a> is the original Rorschach. Verily! So much for all that.</p>

<div>—Malaclypse the Younger, <cite><i>Principia Discordia</i>, Pages 00049–00050</cite></div><br>
</div>