[PD] sending to arbitrary receivers

Frank Barknecht fbar at footils.org
Thu Aug 10 19:00:09 CEST 2006


Hallo,
Orm Finnendahl hat gesagt: // Orm Finnendahl wrote:

> does anybody know a way to send arbitrary length messages to arbitrary
> receivers? I would like to send OSC messages of variable length to pd,
> specifying the receiver in the first element of the message. It has to
> be completely dynamic as I want to create pd subpatchers dynamically,
> so OSCroute won't work.
> 
> It would be possible, if e.g. the send object allowed for a set
> message (or have a right inlet for setting the receiver), or if it was
> possible to use message boxes with Dollarsigns for arbitrary length
> messages.
> 
> Before patching pd's send I thought to better ask for a standard way
> to get this done.

There are various ways. If all you need is to add the "send" in front
of the variable length list of data you want sendOSC to send, then you
can use 

 whatever ...
 |
 [list prepend send]
 |
 [list trim]
 |
 [sendOSC]

If you actually want to send to a variable receiver, you can use some
message-method trickery. I attached an example patch, however I don't
like this approach in general.

A third solution would be to use a fixed send/receiver name and use
[route] to route incoming messages according to their first element. 

You can use the [list prepend]-[list trim] idiom to easily construct
such messages.

Note that these solutions may require Pd 0.39 or better.

Ciao
-- 
 Frank Barknecht                 _ ______footils.org_ __goto10.org__
-------------- next part --------------
#N canvas 282 211 542 365 10;
#X msg 83 251 \;;
#X obj 105 181 list prepend add;
#X obj 105 202 list trim;
#X msg 258 180 set \, addsemi;
#X obj 83 135 t b a b;
#X obj 394 199 r target2;
#X obj 394 225 print t2;
#X obj 394 149 print t1;
#X msg 83 53 list target1 1 2 3 4;
#X obj 394 123 r target1;
#X msg 95 100 target2 hello;
#X text 93 79 or:;
#X connect 1 0 2 0;
#X connect 2 0 0 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 4 1 1 0;
#X connect 4 2 3 0;
#X connect 5 0 6 0;
#X connect 8 0 4 0;
#X connect 9 0 7 0;
#X connect 10 0 4 0;


More information about the Pd-list mailing list