<div dir="ltr"><div>function mychord (data)<br>  with channel = second(data),<br>       keynum = third(data),       <br>       velocity = fourth(data)<br>  send(&quot;mp:midi&quot;, key: key, vel: vel, chan: chan)<br>  send(&quot;mp:midi&quot;, key: key + pick(3,4), vel: vel, chan: chan)<br>  send(&quot;mp:midi&quot;, key: key + 7, vel: vel, chan: chan)<br>end <br>-------------<br></div>response: &#39;mychord&#39;<br>-------------<br>send(&quot;mp:receive&quot;, mm:on, mychord) <br>------------------<br><div><div class="gmail_extra">response: &#39;#t&#39;<br>-------------------<br></div><div class="gmail_extra">[play note]<br>------------------<br>response:<br>&gt;&gt;&gt; Error: :vel not a valid keyword argument in <br>(:key key :vel vel :chan chan) <br>------------------------------------<br><br></div><div class="gmail_extra">That is, it doesn&#39;t work in that example because it needs a variable &#39;velocity&#39; rather than &#39;vel&#39;. (?)<br><br></div><div class="gmail_extra">If I fix that and likewise put the variable &#39;channel&#39; in place of &#39;chan&#39;, &#39;keynum&#39; rather than &#39;key&#39; -- <b>then it works</b>.<br><br></div><div class="gmail_extra">Since I&#39;m working with an ubuntu binary of 3.8.0 I might not be using the latest examples available(?) [I couldn&#39;t install a more recent Grace because my system seems to be allergic to cmake &gt; cmake4.3 -- <br>(perhaps for similar 32-bit --&gt; 64-bit issues?)<br>-------------<br></div><div class="gmail_extra">If I get rid of the &#39;send&#39;s in the mp.midi lines<br></div><div class="gmail_extra">the error instead is:<br>&gt;&gt;&gt; Error: vel: unbound variable <br></div><div class="gmail_extra">and changing everything as before yields:<br><br>&gt;&gt;&gt; Error: mp:midi: unknown key: (:vel 91 :chan 0) <br>in (:key 59 :vel 91 :chan 0) <br><br></div><div class="gmail_extra">The &#39;send&#39; and the &#39;mp:midi&#39; ought to be equivalent; but it&#39;s working with the &#39;send&#39; version, while I don&#39;t see why:<br></div><div class="gmail_extra">  mp:midi(key: keynum, vel: velocity, chan: channel) <br></div><div class="gmail_extra">is not.<br>(?)<br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_quote">On Fri, Feb 19, 2016 at 10:43 AM, Taube, Heinrich K <span dir="ltr">&lt;<a href="mailto:taube@illinois.edu" target="_blank">taube@illinois.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">its not clear to me what the issue is. does it not work.<br>
BTW no need to use send() and just call the function directly so<br>
<span class=""><br>
&gt; send(&quot;mp:midi&quot;, key: key, vel: vel, chan: chan)<br>
<br>
</span>can be written<br>
<br>
mp:midi(key: key, vel: vel, chan: chan)<br>
<br>
i thought I got rid of all that in the documentation and help files.<br>
<div><div class="h5"><br>
<br>
&gt; On Feb 19, 2016, at 10:04 AM, Forrest Curo &lt;<a href="mailto:treegestalt@gmail.com">treegestalt@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; The section is &quot;Input Hooks&quot; (speaking of errors... but still not the first title I&#39;d look for this under.)<br>
&gt;<br>
&gt; On Fri, Feb 19, 2016 at 7:59 AM, Forrest Curo &lt;<a href="mailto:treegestalt@gmail.com">treegestalt@gmail.com</a>&gt; wrote:<br>
&gt; Okay, among &#39;examples&#39; there is a section titled &#39;Output Hooks&#39; (not, to my mind, the most obvious titles to look for)<br>
&gt; and the examples have errors:<br>
&gt; ie<br>
&gt;<br>
&gt; ; An opcode receiver that plays a major or minor chord whenever a<br>
&gt; ; Note On arrives<br>
&gt;<br>
&gt; function mychord (data)<br>
&gt;   with channel = second(data),<br>
&gt;        keynum = third(data),<br>
&gt;        velocity = fourth(data)<br>
&gt;   send(&quot;mp:midi&quot;, key: key, vel: vel, chan: chan)<br>
&gt;   send(&quot;mp:midi&quot;, key: key + pick(3,4), vel: vel, chan: chan)<br>
&gt;   send(&quot;mp:midi&quot;, key: key + 7, vel: vel, chan: chan)<br>
&gt; end<br>
&gt;<br>
&gt; ;; assign receiver for the mm:on opcode (Note Ons)<br>
&gt;<br>
&gt; send(&quot;mp:receive&quot;, mm:on, mychord)<br>
&gt;<br>
&gt; ;; when you are done clear it...<br>
&gt;<br>
&gt; send(&quot;mp:receive&quot;, mm:on, #f)<br>
&gt; -----------------------------------------------------------<br>
&gt;<br>
&gt; It can be fixed, however. This works:<br>
&gt; -------------------------------------------------------------<br>
&gt; function mychord (data)<br>
&gt;   with channel = second(data),<br>
&gt;        keynum = third(data),<br>
&gt;        velocity = fourth(data)<br>
&gt;   send(&quot;mp:midi&quot;, key: keynum, amp: velocity, chan: channel)<br>
&gt;   send(&quot;mp:midi&quot;, key: keynum + pick(3,4), amp: velocity, chan: channel)<br>
&gt;   send(&quot;mp:midi&quot;, key: keynum + 7, amp: velocity, chan: channel)<br>
&gt; end<br>
&gt;<br>
&gt; ;; assign receiver for the mm:on opcode (Note Ons)<br>
&gt;<br>
&gt; send(&quot;mp:receive&quot;, mm:on, mychord)<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Feb 18, 2016 at 9:10 PM, Forrest Curo &lt;<a href="mailto:treegestalt@gmail.com">treegestalt@gmail.com</a>&gt; wrote:<br>
&gt; I see a tutorial on sending midi out<br>
&gt;<br>
&gt; and ways to declare a function to be receiving midi in with specific opcodes<br>
&gt;<br>
&gt; but I&#39;m not at all clear on how such a function should be written to extract the data when a midi message comes in.<br>
&gt;<br>
&gt; Examples anywhere?<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; Cmdist mailing list<br>
&gt; <a href="mailto:Cmdist@ccrma.stanford.edu">Cmdist@ccrma.stanford.edu</a><br>
&gt; <a href="https://cm-mail.stanford.edu/mailman/listinfo/cmdist" rel="noreferrer" target="_blank">https://cm-mail.stanford.edu/mailman/listinfo/cmdist</a><br>
<br>
</blockquote></div><br></div></div></div>