[CM] midi-received functions
Taube, Heinrich K
taube at illinois.edu
Fri Feb 19 10:43:25 PST 2016
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 <treegestalt at gmail.com> 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 <treegestalt at gmail.com> 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 <treegestalt at 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 at ccrma.stanford.edu
> https://cm-mail.stanford.edu/mailman/listinfo/cmdist
More information about the Cmdist
mailing list