Radiation detector send to trigger lights
-
@dusx- Could you explain this more? It is looking more like a live OSC send will not work with the hardware we have available. When you say Read () and Include (). What are you putting that into, a text file? what actor are you using to get the info into Isadora? Javascript actor? Thanks.
-
These are Javascript functions. These functions are specific to Javascript in Isadora, they have been added to facilitate external data.
This tutorial covers the use of include() https://support.troikatronix.c...
read() is easier, it takes what ever text is in the file and stores it in memory, you can then assign it to a variable.var myText = read("path/to/data/file.txt");
this line of code will read the file.txt file and store its contents in myText.
If this file contains JSON formatted data, you can use JSON.parse() to convert the data into a native Javascript data format.var objData = JSON.parse(myText);
above we take the text content of myText and parse it into a Javascript object (think array for now).
The tutorial linked above also covers some basics of JSON, so it may be helpful in understanding what JSON.parse() does as well.
Since read() unlike include() doesn't need to be located an the first line of your Javascript code, it is possible to use it in a way that will read the external file continuously.
You should however limit the speed at which this file is being read (determined by how the code is constructed). Also, depending on how this external text file is created/written to, you may experience a file lock.
Where both the writer and reader try to access the file at the same time. I am not sure what the outcome of this situation would be, perhaps just a Javascript error for that attempt. -
@dusx- Thank you! Right now we are reading our .text file as an array with the DataArray actor and getting excellent results. I will look at the tutorial if we decide to go this route.
-
Just did a quick test, and reading a txt file at 120hz (not suggested) that contained a single number.
Where I had the txt file open in a text editor and manually changed and saved the file numerous times caused 0 issues, so the file lock consideration seems minimal (and would be the same for the data array).the code used for loading a single value in a text file called read.txt:
function main()
{
var i = read('read.txt');
return [i];
}the above code runs every time an input come into the Javascript actor.
To run this at a specific rate, I connected a Pulse Generators trigger output to the Javascript actors input 1.
Then the code will be run each time the pulse triggers the JS actor.