its not clear to me what the issue is. does it not work.
BTW no need to use send() and just call the function directly so

> send("mp:midi", key: key, vel: vel, chan: chan)

can be written

mp:midi(key: key, vel: vel, chan: chan)

i thought I got rid of all that in the documentation and help files.


> On Feb 19, 2016, at 10:04 AM, Forrest Curo <[email protected]> wrote:
> 
> The section is "Input Hooks" (speaking of errors... but still not the first 
> title I'd look for this under.)
> 
> On Fri, Feb 19, 2016 at 7:59 AM, Forrest Curo <[email protected]> wrote:
> Okay, among 'examples' there is a section titled 'Output Hooks' (not, to my 
> mind, the most obvious titles to look for)
> and the examples have errors:
> ie
> 
> ; An opcode receiver that plays a major or minor chord whenever a
> ; Note On arrives
> 
> function mychord (data)
>   with channel = second(data),
>        keynum = third(data),       
>        velocity = fourth(data)
>   send("mp:midi", key: key, vel: vel, chan: chan)
>   send("mp:midi", key: key + pick(3,4), vel: vel, chan: chan)
>   send("mp:midi", key: key + 7, vel: vel, chan: chan)
> end
> 
> ;; assign receiver for the mm:on opcode (Note Ons)
> 
> send("mp:receive", mm:on, mychord)
> 
> ;; when you are done clear it...
> 
> send("mp:receive", mm:on, #f)
> -----------------------------------------------------------
> 
> It can be fixed, however. This works:
> -------------------------------------------------------------
> function mychord (data)
>   with channel = second(data),
>        keynum = third(data),       
>        velocity = fourth(data)
>   send("mp:midi", key: keynum, amp: velocity, chan: channel)
>   send("mp:midi", key: keynum + pick(3,4), amp: velocity, chan: channel)
>   send("mp:midi", key: keynum + 7, amp: velocity, chan: channel)
> end
> 
> ;; assign receiver for the mm:on opcode (Note Ons)
> 
> send("mp:receive", mm:on, mychord) 
> 
> 
> On Thu, Feb 18, 2016 at 9:10 PM, Forrest Curo <[email protected]> wrote:
> I see a tutorial on sending midi out
> 
> and ways to declare a function to be receiving midi in with specific opcodes
> 
> 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.
> 
> Examples anywhere?
> 
> 
> 
> 
> _______________________________________________
> Cmdist mailing list
> [email protected]
> https://cm-mail.stanford.edu/mailman/listinfo/cmdist


_______________________________________________
Cmdist mailing list
[email protected]
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to