[CM] midi-received functions
Taube, Heinrich K
taube at illinois.edu
Sat Feb 20 05:37:17 PST 2016
if you are in 3.9.0 and its working as you expect im happy!
> On Feb 19, 2016, at 10:46 PM, Forrest Curo <treegestalt at gmail.com> wrote:
>
> Given that the error isn't from the current distribution, I suppose there's no issue...
>
> Ah, I seem to have finally bumbled through installing 3.9.0, thanks!
>
> On Fri, Feb 19, 2016 at 2:19 PM, Forrest Curo <treegestalt at gmail.com> wrote:
> 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
> -------------
> response: 'mychord'
> -------------
> send("mp:receive", mm:on, mychord)
> ------------------
> response: '#t'
> -------------------
> [play note]
> ------------------
> response:
> >>> Error: :vel not a valid keyword argument in
> (:key key :vel vel :chan chan)
> ------------------------------------
>
> That is, it doesn't work in that example because it needs a variable 'velocity' rather than 'vel'. (?)
>
> If I fix that and likewise put the variable 'channel' in place of 'chan', 'keynum' rather than 'key' -- then it works.
>
> Since I'm working with an ubuntu binary of 3.8.0 I might not be using the latest examples available(?) [I couldn't install a more recent Grace because my system seems to be allergic to cmake > cmake4.3 --
> (perhaps for similar 32-bit --> 64-bit issues?)
> -------------
> If I get rid of the 'send's in the mp.midi lines
> the error instead is:
> >>> Error: vel: unbound variable
> and changing everything as before yields:
>
> >>> Error: mp:midi: unknown key: (:vel 91 :chan 0)
> in (:key 59 :vel 91 :chan 0)
>
> The 'send' and the 'mp:midi' ought to be equivalent; but it's working with the 'send' version, while I don't see why:
> mp:midi(key: keynum, vel: velocity, chan: channel)
> is not.
> (?)
>
>
>
>
> On Fri, Feb 19, 2016 at 10:43 AM, Taube, Heinrich K <taube at illinois.edu> wrote:
> 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
>
>
>
> _______________________________________________
> Cmdist mailing list
> Cmdist at ccrma.stanford.edu
> https://cm-mail.stanford.edu/mailman/listinfo/cmdist
More information about the Cmdist
mailing list