Radiation detector send to trigger lights
-
@joejdrums
I'm not an expert on Json data (DusX is) but from what I know, you can save Json data in a text file and read it with the javascript actor.
I think there are other ways of importing Json but i never had the need of using it before.OSC would only be possible if the other software can send osc. And if it is an industrial software i doubt it will have an osc function.
-
@gertjanb: so the javascript actor inserted in place of the OSC Listener in the patch shown above?
-
@joejdrums
Your javascript will have an array it sends out, so you will have multiple outputs. These outputs can be a value or text.
If its a value you can swap it for the osc listener in the patch above. (you probably won't be needing the limit scale value because you can do that in your javascript.)
-
@gertjanb: Looks like the software the student is using does send OSC information. Real time looks possible if desired.
-
Update. The workflow is as follows. Homemade Gieger meter is sending analog signal through a digital converter into a computer running LabView. LabView can run NI OSC library in it so we should be able to get a live send from LabView into Izzy!
Questions- How to pull in the OSC message via the network into the OSC Listener? Izzy will more than likely be running on one machine and LabView will be sending on another. I recall an actor called OSC Receiver but cannot find it? How does Izzy "receive" the send from LabView's OSC output?
-
@gertjanb said:
Every time the Javascript acter is triggered it reads the file again
The reading of external files can be done 2 ways. Using the Read() and Include() functions.
Include must be the first line of your code, and will simply include the text in the file passed to it as additional Javascript. (parsed inline with your code after).
Read can put the text content of a file into a variable. This one can be used on command.
If using Include(), the command is run on Initialization of the javascript actor (this can be triggered via a User Actor on/off if within an user actor)
Read() can be called as part of a function. I wouldn't suggest calling it constantly (this will be a slowdown to the system), rather use a trigger input to call the function containing Read() when required.
Either of these can help you with reading JSON, but I would recommend Read() for getting data, and Include() for code Libraries (CSV parsing libs, XML parsing libs etc..)
-
@dusx: Thanks! That will be very helpful if we deal with files. Trying to understand how to have OSC listener "hear" the network send from LabView in real time?
-
open the communication menu --> stream setup --> and click on auto-detect input. The source machine has to send to the IP address of the receiving computer.
Best Michel
-
@jetjaguar said:
@dusx: Thanks! That will be very helpful if we deal with files. Trying to understand how to have OSC listener "hear" the network send from LabView in real time?
You basically need to know the IP address and the port number it is sending to.
It's a little hard to explain how this work over text/written words.
-
also> check the OSC port number in Preferences. it needs to be the same as the one being used by your interface application to send the OSC. i think i remember correctly that the default is 1234. if you change it in Izzy, you need to restart Izzy for it to take effect. and> OSC coming into Izzy needs to start with a forward slash.
-
A tutorial I did for TouchOSC and Isadora. The methods are the same, just pretend Touch OSC is instead LabView (....kinda)
-
Excellent! Will play with all of this over next week or so, great community of support for Izzy.
-
@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.