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 <treegest...@gmail.com> 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
Cmdist@ccrma.stanford.edu
https://cm-mail.stanford.edu/mailman/listinfo/cmdist

Reply via email to