<div dir="ltr"><div>function mychord (data)<br> with channel = second(data),<br> keynum = third(data), <br> velocity = fourth(data)<br> send("mp:midi", key: key, vel: vel, chan: chan)<br> send("mp:midi", key: key + pick(3,4), vel: vel, chan: chan)<br> send("mp:midi", key: key + 7, vel: vel, chan: chan)<br>end <br>-------------<br></div>response: 'mychord'<br>-------------<br>send("mp:receive", mm:on, mychord) <br>------------------<br><div><div class="gmail_extra">response: '#t'<br>-------------------<br></div><div class="gmail_extra">[play note]<br>------------------<br>response:<br>>>> 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't work in that example because it needs a variable 'velocity' rather than 'vel'. (?)<br><br></div><div class="gmail_extra">If I fix that and likewise put the variable 'channel' in place of 'chan', 'keynum' rather than 'key' -- <b>then it works</b>.<br><br></div><div class="gmail_extra">Since I'm working with an ubuntu binary of 3.8.0 I might not be using the latest examples available(?) [I couldn't install a more recent Grace because my system seems to be allergic to cmake > cmake4.3 -- <br>(perhaps for similar 32-bit --> 64-bit issues?)<br>-------------<br></div><div class="gmail_extra">If I get rid of the 'send's in the mp.midi lines<br></div><div class="gmail_extra">the error instead is:<br>>>> Error: vel: unbound variable <br></div><div class="gmail_extra">and changing everything as before yields:<br><br>>>> 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 'send' and the 'mp:midi' ought to be equivalent; but it's working with the 'send' version, while I don'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"><<a href="mailto:taube@illinois.edu" target="_blank">taube@illinois.edu</a>></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>
> send("mp:midi", 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>
> On Feb 19, 2016, at 10:04 AM, Forrest Curo <<a href="mailto:treegestalt@gmail.com">treegestalt@gmail.com</a>> wrote:<br>
><br>
> The section is "Input Hooks" (speaking of errors... but still not the first title I'd look for this under.)<br>
><br>
> On Fri, Feb 19, 2016 at 7:59 AM, Forrest Curo <<a href="mailto:treegestalt@gmail.com">treegestalt@gmail.com</a>> wrote:<br>
> Okay, among 'examples' there is a section titled 'Output Hooks' (not, to my mind, the most obvious titles to look for)<br>
> and the examples have errors:<br>
> ie<br>
><br>
> ; An opcode receiver that plays a major or minor chord whenever a<br>
> ; Note On arrives<br>
><br>
> function mychord (data)<br>
> with channel = second(data),<br>
> keynum = third(data),<br>
> velocity = fourth(data)<br>
> send("mp:midi", key: key, vel: vel, chan: chan)<br>
> send("mp:midi", key: key + pick(3,4), vel: vel, chan: chan)<br>
> send("mp:midi", key: key + 7, vel: vel, chan: chan)<br>
> end<br>
><br>
> ;; assign receiver for the mm:on opcode (Note Ons)<br>
><br>
> send("mp:receive", mm:on, mychord)<br>
><br>
> ;; when you are done clear it...<br>
><br>
> send("mp:receive", mm:on, #f)<br>
> -----------------------------------------------------------<br>
><br>
> It can be fixed, however. This works:<br>
> -------------------------------------------------------------<br>
> function mychord (data)<br>
> with channel = second(data),<br>
> keynum = third(data),<br>
> velocity = fourth(data)<br>
> send("mp:midi", key: keynum, amp: velocity, chan: channel)<br>
> send("mp:midi", key: keynum + pick(3,4), amp: velocity, chan: channel)<br>
> send("mp:midi", key: keynum + 7, amp: velocity, chan: channel)<br>
> end<br>
><br>
> ;; assign receiver for the mm:on opcode (Note Ons)<br>
><br>
> send("mp:receive", mm:on, mychord)<br>
><br>
><br>
> On Thu, Feb 18, 2016 at 9:10 PM, Forrest Curo <<a href="mailto:treegestalt@gmail.com">treegestalt@gmail.com</a>> wrote:<br>
> I see a tutorial on sending midi out<br>
><br>
> and ways to declare a function to be receiving midi in with specific opcodes<br>
><br>
> but I'm not at all clear on how such a function should be written to extract the data when a midi message comes in.<br>
><br>
> Examples anywhere?<br>
><br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Cmdist mailing list<br>
> <a href="mailto:Cmdist@ccrma.stanford.edu">Cmdist@ccrma.stanford.edu</a><br>
> <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>