<div dir="ltr"><div><div><div>Okay, among 'examples' there is a section titled 'Output Hooks' (not, to my mind, the most obvious titles to look for)<br></div>and the examples have errors:<br></div>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></div>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></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 18, 2016 at 9:10 PM, Forrest Curo <span dir="ltr"><<a href="mailto:treegestalt@gmail.com" target="_blank">treegestalt@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>I see a tutorial on sending midi out<br><br></div><div>and ways to declare a function to be receiving midi in with specific opcodes<br></div><div><br></div>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></div>Examples anywhere?<br><br><br></div>
</blockquote></div><br></div>