Send multiple values between User Actors with a single patch cord!
-
I just put together a quick how to.
Hopefully you all find it as useful as I am.
http://dusxproductions.com/blo...NEW Troikatronix official tutorial.
https://support.troikatronix.c...
AND a quick code update to the Ungrouping, that allows handling more complex JSON (maybe from the web or my Kinect2share utility)
function debug(printString){ if (DebugMode){ print(printString + "\n"); } }
function main()
{
DebugMode = false; //example usage: debug("string" + var + "\n");// ensure input is not EMPTY if (arguments[0].length < 1){ debug("arg0 length: " + arguments[0].length + "\n"); return array; } var parsed = JSON.parse(arguments[0]); var array = []; for (elem in parsed ) { if (typeof parsed[elem] == 'object') { parsed[elem] = JSON.stringify(parsed[elem]) } array .push(parsed[elem]); } array.unshift(array.length); // make the first output value //a count of additional outputs needed return array;
}
It may be also useful to some to know that the Ungrouping Handles arrays such as [0,1,2,3,4] just the same as Json objects like {"0":0,"1":1,"2":2,"3":3,"4":4}
These 2 structures break down the same in the Ungroup, supplying 5 outputs with values 0 thru 4 -
Looks really interesting. I still don't really understand Javascript properly. I need to spend more time with it.
-
Well if you are starting a big project. These 2 small scripts can save you hours of patching.. no need to learn any thing to gain here ;)
-
umbilical!
-
I have included these 2 scripts in a Javascript skeleton actor that I use now to start all JS based elements of my patches. . JS is proving very useful for video analysis (array sorting) in Izzy.. 'measure color' is my current favorite actor.
-
Performing some thread necromancy because I made an >>>EXAMPLE PATCH AND MACROS/USER ACTORS<<< for this wonderful concept.
All credit is due to DusX for the idea and the original tutorial though.
Best wishes,
Woland
-
@dusx very nice, but as Isadora is a node based system cant we have this as part of normal operations with actors? An user_input or user_output node for user actors that amalgamates signals?
-
@fred said:
@dusx very nice, but as Isadora is a node based system cant we have this as part of normal operations with actors? An user_input or user_output node for user actors that amalgamates signals?
All one would need to do is wrap it in a User Actor or Macro and it would be functionally the same as having a native actor; in some ways it would be even better because it has the potential to be more flexible.
At least that's my opinion.
Best wishes,
Woland
-
@woland Yes sure, that is true. One question, can I send video in one of the channels with this group actor?
-
-
@woland yes, I thought so, and I don't think it is possible with Javascript to do that, at least from this setup (comma separated fields). That is why I think it would be good to have this as a real user actor IO option.
-
@fred said:
That is why I think it would be good to have this as a real user actor IO option.
-
Agreed it would be cool to be able to bundle video. That said this is using standard JSON so it's useful for an number of things (web data etc..)
You can include a broadcast channel and pick it up on the other end to set a listener.. it works if you keep track of channels (namespacing would be better).
-
Don't forget that naming Javascript inputs and outputs is a feature coming in Isadora 3 ;)