<div dir="ltr">FWIW, I'm definitely interested in hearing more about CM-incudine on here! :-)<div><br></div><div>iain</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 5, 2021 at 7:31 AM Brandon Hale <<a href="mailto:bthaleproductions@gmail.com">bthaleproductions@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I just got around to trying this out, and man, this is awesome! Being <br>
able to trigger common music events with the incudine responder is <br>
excellent.<br>
<br>
For the responders, you would have to create a new responder for each <br>
event you would want for different osc messages, right?<br>
<br>
Thanks for your help!<br>
<br>
On 4/1/21 1:46 PM, Brandon Hale wrote:<br>
> Thanks so much Orm! I didn't know if the cmdist list would also <br>
> support your cm-incudine, but it would be better to have an open <br>
> discussion for others seeking help on this.<br>
><br>
> I will play with this and report back if I have any questions. Thank <br>
> you for the detailed explanation and the awesome example!<br>
><br>
> On 4/1/21 11:58 AM, Orm Finnendahl wrote:<br>
>> Hey Brandon,<br>
>><br>
>> Am Donnerstag, den 01. April 2021 um 09:29:16 Uhr (-0400) schrieb<br>
>> Brandon Hale:<br>
>>> Hey Orm,<br>
>>><br>
>>> I hope it's okay to send questions your way. I've been really <br>
>>> interested in<br>
>>> trying to receive OSC messages into common music. I've looked at your<br>
>>> documentation in cm-incudine/README.org about opening the port for <br>
>>> OSC and<br>
>>> your README says to look into the common music docs for handling input<br>
>>> events. Is that the (INPUT) function that I would look into from common<br>
>>> music? I am really interested in triggering (EVENTS) from OSC messages.<br>
>> it's ok to contact me, although the cmdist list should be an<br>
>> appropriate forum for such questions, even if it's CL and CM2 related.<br>
>><br>
>> I therefore also forward my response to the cmdist list. Maybe there<br>
>> are people out there using CM2 on CL.<br>
>><br>
>><br>
>> In the current CM2 version on my github repository, OSC i/o is handled<br>
>> by incudine. Main reasons are:<br>
>><br>
>> 1. incudine is optimized for OSC messages and<br>
>><br>
>> 2. Although OSC had been implemented in Common Music 2, back then it<br>
>> seems to have been mainly used for communication with super<br>
>> collider, probably wasn't used very much and therefore isn't well<br>
>> documented. I looked into the implementation before but remember<br>
>> that I wasn't sure the implementation was very practical as you had<br>
>> to define classes and methods for every message type. For your<br>
>> purpose I guess it's more straightforward using incudine directly<br>
>> for receiving OSC. You can call the events macro within the<br>
>> responders.<br>
>><br>
>> Below is an example. Let me know if that works for you. In case you<br>
>> want to avoid the incudine: prefix, you can (use-package :incudine) or<br>
>> maybe it is even sufficient with (use-package :incudine.osc).<br>
>><br>
>> For more info on OSC handling you can refer to the incudine doc<br>
>> (<a href="http://incudine.sourceforge.net/incudine.html" rel="noreferrer" target="_blank">http://incudine.sourceforge.net/incudine.html</a>), and it should also be<br>
>> mentioned on one page of incudine's tutorials.<br>
>><br>
>> Best,<br>
>> Orm<br>
>> ---------------------------------------------------------<br>
>><br>
>> ;;; open a connection "socket":<br>
>><br>
>> (setf *osc-in* (incudine.osc:open :direction :input :host "127.0.0.1" <br>
>> :port 3091))<br>
>><br>
>> ;;; start listening on the socket:<br>
>><br>
>> (incudine:recv-start *osc-in*)<br>
>><br>
>> ;;; define a responder (an association between the osc route/arg types<br>
>> ;;; and a function to call on the args). In this case an anonymus<br>
>> ;;; lambda function is used, but you could also specify a named<br>
>> ;;; function, using the #' prefix on the function name.<br>
>><br>
>> (defparameter *osc-responder*<br>
>> (incudine:make-osc-responder *osc-in* "/osc/test" "fff"<br>
>> (lambda (a b c)<br>
>> (format t "~f ~f ~f~%" a b c))))<br>
>><br>
>> ;;; add the responder to the list of responder functions to be invoked,<br>
>> ;;; when the socket receives input:<br>
>><br>
>> (incudine:add-responder *osc-responder*)<br>
>><br>
>> ;;; after this you should be able to send 3 floats to /osc/test over<br>
>> ;;; osc and the floats should be printed in the REPL.<br>
>><br>
>> ;;; The previous 2 steps of course could be done in one step with:<br>
>><br>
>> ;;; (incudine:add-responder<br>
>> ;;; (incudine:make-osc-responder<br>
>> ;;; ...<br>
>> ;;; ))<br>
>><br>
>> ;;; the following two functions are for inspection<br>
>><br>
>> ;;; check if osc-receiver is running:<br>
>><br>
>> (incudine:recv-status *osc-in*)<br>
>><br>
>> ;;; Check which functions are active in the receiver:<br>
>><br>
>> (incudine:recv-functions *osc-in*)<br>
>><br>
>> ;;; close connection by undoing the previous three steps in reverse<br>
>> ;;; order:<br>
>><br>
>> (incudine:remove-responder *osc-responder*)<br>
>> (incudine:recv-stop *osc-in*)<br>
>> (incudine.osc:close *osc-in*)<br>
>><br>
>> ;;; Although it sounds unnecessarily complicated the advantage of this<br>
>> ;;; modularized approach is that you can dynamically add/remove<br>
>> ;;; responders or stop/restart listening without having to remove and<br>
>> ;;; add the responders again.<br>
_______________________________________________<br>
Cmdist mailing list<br>
<a href="mailto:Cmdist@ccrma.stanford.edu" target="_blank">Cmdist@ccrma.stanford.edu</a><br>
<a href="https://cm-mail.stanford.edu/mailman/listinfo/cmdist" rel="noreferrer" target="_blank">https://cm-mail.stanford.edu/mailman/listinfo/cmdist</a><br>
</blockquote></div>