[CM] midi-received functions
Forrest Curo
treegestalt at gmail.com
Fri Feb 19 08:04:56 PST 2016
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?
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cm-mail.stanford.edu/mailman/private/cmdist/attachments/20160219/9b3cfdbe/attachment-0001.html>
More information about the Cmdist
mailing list