Hi all,
I would like to know how to construct a lambda patch (or alternatively a lisp function) for the “route” box of the reactif-lib to perform tests on the incoming messages. In particular, this test involves the use of the “coll” object, with its “push” and “data” slots. The test should behave like that (as suggested by Jean Bresson):
test (if first element of the OSC message = 9999) then => push
else => data
“Coll” should then output a new list each time is received an OSC message whose first element is 9999. Thanks in advance for your kind concern.
Best regards,
Francesco Vitale
the best solution is to differentiate the OSC messages (in your sender application) depending on where they are intended to go (that’s pretty much what the OSC “addresses” were designed for I think). If you send two kinds of messages, say [/aaa/bbb/params 0 0 0] and [/aaa/bbb/new 0], you can route them with route-OSC (a version of route specialized for OSC messages)
Set the tests of route-OSC with “/aaa/bbb/param” and “/aaa/bbb/new” (strings), then ‘param’ messages can then be routed to the coll’s ‘data’ and ‘new’ messages can be routed to coll’s ‘push’.
Dear Jean,
after many trials, unfortunately it seems I don’t have the possibility in my sender software to mark each new bundle of messages with a message like “new” (e.g. osc://127.0.0.1:3010/new): I can only use a number ID (i.e. 9999). Is it possible to make route-OSC work only with the ID? If yes, how? Thanks for your patience.
Best,
Francesco
I forgot to clarify that the ID is what follows every message of the form “osc://127.0.0.1:3010/param”. Since I cannot substitute /param with another line like “/new”, the only way to mark the messages is the ID. Thus the problem is: is it possible to differentiate the OSC messages for route-OSC on the base of the first element of the messages?
Best,
Francesco
ok then you should follow your first idea and use the ‘route’ box
the test can be like :
(lambda (message) (= (second message) 9999))
Dear Jean,
I have two problems:
- if I use the box lispfunction with your lambda I get this alert: “Error while evaluating the box lispfunction: Arithmetic error in = of (nil 9999): Arguments must be numbers”. Is the test wrong?
- What are the right connections between route and coll?
Thanks for all.
Best,
Francesco
Dear Jean,
for sure I keep doing something wrong in my patching (see the screenshot), because coll doesn’t group at all the messages in the desired may. In fact I get a list like this:
((/param 9999.0F0 -38.94226837158203 0 19.5))
((/param 1673.0F0 -39.035125732421875 -3.0830070972442627 0))
((/param 1674.0F0 -39.03631591796875 -3.0796597003936768 0))
((/param 1909.0F0 -39.035125732421875 -3.0830070972442627 0))
((/param 1910.0F0 -39.03631591796875 -3.0796597003936768 0))
((/param 9999.0F0 -38.94226837158203 0 19.5)), etc…
Could you please tell me where the error is?
P.S. I’ve tried a great number of combinations in the connections between route and coll, but they all give the same result here reported. What are the right connections?
Many thanks,
Francesco
Hi,
here’s an example (see the text screenshot attached) of what I get with this patch (see the patch screenshot):
My questions are:
1)why are there all these unnecessary parentheses? How can I remove them?
2)why the message with the 9999 ID (that should be used for the grouping) is never the first of each group of messages? (Check the text screenshot)
I guess that the grouping is not working in the desired way. Any ideas to make it work? Thanks for your attention.
Best,
Francesco