< Back to IRCAM Forum

Accumulate multiple messages from OSC

Hi again,

I am receiving large amounts of numbers from Max through OSC receive. I am trying to firgure out how to build a lambda patch that accumulates these messages into a single list that I can recall whenever I am done sending messages from max. I am thinking that an Array would be the best solution (I am sending matrices) but I am not quite sure how to have OM accumulate in the lambda patch.

Suggestions?

Thanks!

Michele

nevermind, I managed using a global variable…

Happy you found a way. I think your issue hits one of OMs sore toes, the global-var/store or get-slot/set-slot combos are really cumbersome where there’s on built in . I guess we could make up a ‘slots’ box for lists…(or perhaps there’s a way to achieve one already?)

thinking of it, even with a slots box, it’s difficult to get by making it into a global variable in this case (with the osc-receiver thread explicitly applying the lambda-function pr. received message)

Anders,
this little patch works fine for me. It appends any incoming message to whatever is stored in the global variable.
Does this make sense to you?

Screen-Shot-2014-04-06-at-5.06.58-PM.png

Hi all
FYI, I am currently working on a model which will allow to make patches reactive and simulate data-flow executions in OM.
This will make it much easier for instance to receive and collect data from OSC-receive.
I will try to make a beta release available soon with some documentation. stay tuned:)
Best
Jean

Thanks Jean, very much looking forward to that!

Michele

your patch looks great. Attached is a slight variant, using ‘slots’-boxes for store to place readers and writers:

sorry, i scrubbed the attachment, here’s one more:

101.png

Hello again.

I have posted some info and a download for the “reactif-lib” here : http://repmus.ircam.fr/efficace/wp/reactif

This is still a prototype, so do not expect too much and do not hesitate to contact me for more info.

Typically in your case, you will need to use OSC-receive + a coll box in order to collect the data.

route-osc might help to select incoming messages and select to init, collect or push the data upon reception.

Jean

Thanks Jean, I will try them soon.

Michele

Hi!

I have been working with the reactif lib and… so far so good!
This is a great improvement for Open Music that can now be used in the background to constantly receive and send streams of data directly from max.
Thanks a bunch Jean!!!

Michele

Hi Michele and all,
since you’ve been testing the reacif-lib, I have a question for you (always regarding the issue of accumulating multiple messages from OSC). Suppose I have a series of messages arranged like this:

osc://127.0.0.1:3010/param 0.0 0.5571038126945496 0.00035971225588582456 -0.06091249734163284 osc://127.0.0.1:3010/param 1.0 1.187748670578003 0.00035971225588582456 0.044781528413295746 osc://127.0.0.1:3010/param 2.0 0.6294140219688416 0.00035971225588582456 0.013506295159459114 osc://127.0.0.1:3010/param 3.0 1.7329837083816528 0.00035971225588582456 0.012245512567460537 osc://127.0.0.1:3010/param 4.0 1.3821840286254883 0.00035971225588582456 0.012158313766121864

… [999 ms delay]

osc://127.0.0.1:3010/param 0.0 0.5571038126945496 0.00035971225588582456 -0.06091249734163284 osc://127.0.0.1:3010/param 1.0 1.187748670578003 0.00035971225588582456 0.044781528413295746 osc://127.0.0.1:3010/param 2.0 0.6294140219688416 0.00035971225588582456 0.013506295159459114 osc://127.0.0.1:3010/param 3.0 1.7329837083816528 0.00035971225588582456 0.012245512567460537 osc://127.0.0.1:3010/param 4.0 1.3821840286254883 0.00035971225588582456 0.012158313766121864

… [999 ms delay]

osc://127.0.0.1:3010/param 0.0 0.5571038126945496 0.00035971225588582456 -0.06091249734163284 osc://127.0.0.1:3010/param 1.0 1.187748670578003 0.00035971225588582456 0.044781528413295746 osc://127.0.0.1:3010/param 2.0 0.6294140219688416 0.00035971225588582456 0.013506295159459114 osc://127.0.0.1:3010/param 3.0 1.7329837083816528 0.00035971225588582456 0.012245512567460537 osc://127.0.0.1:3010/param 4.0 1.3821840286254883 0.00035971225588582456 0.012158313766121864 osc://127.0.0.1:3010/param 5.0

where the “bundles” of triples of reals (each preceded by an ID number like 1.0, 2.0, 3.0, etc…) are sent separated by a small time delay of 999 ms. I guess I should use something like timed-coll, because I’d need to group each bundle of messages, considering the messages in each bundle as simultaneous.
So: how would you use the reactif-lib (and timed-coll in particular) to process the OSC messages according to this “bundling”? The result to be written in a textfile object, should look like this (i.e. a list of lists):

(0.5571038126945496 3.5971225588582456E-4 -0.06091249734163284
1.187748670578003 3.5971225588582456E-4 0.044781528413295746
0.6294140219688416 3.5971225588582456E-4 0.013506295159459114 1.7329837083816529 3.5971225588582456E-4 0.012245512567460537
1.3821840286254883 3.5971225588582456E-4 0.012158313766121865 …)
(0.5571038126945496 3.5971225588582456E-4 -0.06091249734163284
1.187748670578003 3.5971225588582456E-4 0.044781528413295746
0.6294140219688416 3.5971225588582456E-4 0.013506295159459114
1.7329837083816529 3.5971225588582456E-4 0.012245512567460537
1.3821840286254883 3.5971225588582456E-4 0.012158313766121865 …)
(0.5571038126945496 3.5971225588582456E-4 -0.06091249734163284
1.187748670578003 3.5971225588582456E-4 0.044781528413295746
0.6294140219688416 3.5971225588582456E-4 0.013506295159459114
1.7329837083816529 3.5971225588582456E-4 0.012245512567460537
1.3821840286254883 3.5971225588582456E-4 0.012158313766121865 …)

Thanks for your kind attention.
Best regards,
Francesco Vitale

Hi all of you,

A suggestion, why don’t use directly Max for these purpose ? Is there any advantage to use OM as a real time “reactif” environment?
I would be glad to hear from you about the cons and pros of such programming.

Thanx
K

Dear Karim,
not everybody uses Max. And this is my case: I don’t have Max and I will not get it any time soon – at least until IRCAM won’t include it in the Individual Annual Premium Access… :wink:
Best,
Francesco

@francesco:
I think you can try to use timed-coll just connecting your osc-received data to the 1st input (data-in) and set a delay which is < 999ms but reasonably big so as to encompass all the data received in each group of messages.

@karim
Reactive processes in OM are not supposed to substitute Max real-time/data flow. This system makes OM patches (or specific parts of the patches) reactive in the sense that modifications of box values will find out and update the value of other boxes which depend on them.
These modifications (that I call “events”) can originate from user actions (e.g. in editors) or from external processes via MIDI or OSC-receive.
I think such reactive processes can enhance the possibilities of experimentation at setting input values in OM programs, but also allow interesting new applications where the OM programs are embedded (parameterized and triggered) in larger-scale interactions.
I’d also be interested in getting feedback and knowing about “real” applications of the system.

Ok Jean. But then, how do I write in a textfile the data processed from timed-coll? What are the right slot connections between timed-coll and textfile? Many thanks for your kind reply and for your patience.
Best,
Francesco

The first output of timed coll is the data (2nd output are times).
So, connect this to your textfile “exp-list” input (2nd input if I remember well)

This makes me thing of (maybe) an easier solution: you could just use the group-in function and the textfile in mode “append” instead of “supersede” (3rd input)