Intercepting coll output on 'length' message

Dan Laüt's icon

The coll's response to the 'length' message goes to the same output as the data output and there's nothing to identify it for what it is. A 'length' prefix, for instance. Or routing to another output.

It's hard to believe that one really needs a gate to achieve this, but there seems to be no other way.

The logic: The message 'length' is passed to a trigger which first sets a ggate to 0, then passes the message to the coll. The coll's output is passed to a trigger which first outputs the value, then sets the ggate to 1, so that all other output from the coll is routed to ggate[1].

Max Patch
Copy patch and select New From Clipboard in Max.

Jean-Francois Charles's icon

Indeed, using a gate is a classic in that case. Also like this:

Max Patch
Copy patch and select New From Clipboard in Max.

Another option is to use a named coll:

Max Patch
Copy patch and select New From Clipboard in Max.

Dan Laüt's icon

Very elegant! Thank you. As to using a named coll: why didn't I think of that???
I do wish for a 'name' attribute, but I guess that would get rather involved with coll.

Jean-Francois Charles's icon

No name attribute, but the 'refer' message can be useful.
Also, you can have an empty coll with a name, but prevent it from looking from an associated file to load: just add a further argument after the name. [coll toto 1] is a named coll (toto) but is not going to try to load the file toto.

pdelges's icon

Using grab is another option.

Russell Richards's icon

I had the same bind - excellent solution to the problem @Jean-Francois.

Thanks.
Russell

Source Audio's icon

as Patrick suggested - grab is the proper way.
addind colls, refering to them etc - unneeded

Peter Ostry's icon

I use both, grab and named colls, depending on the size of the coll and the position in the patch. Grabbing a small coll from the "other side" of the patch makes no sense, duplicating a coll next to another or gating one just to measure the length does not either.

Grab is preferable. Don't forget the small delay with grab, I can normally catch it with [deferlow].