Passing values for stimulations

Making & changing box plugins and external apps
Post Reply
slightly
Posts: 5
Joined: Sun Dec 29, 2019 4:04 pm

Passing values for stimulations

Post by slightly »

hi!
(first off, im not a programmer or coder, but am able to muck around with stuff found on the web and put things together).
I wanted to use Muse to connect with openvibe and capture my brainwaves while i listen to guided meditation or self-hypnosis audios (or watch video). The idea is that the stream records values and I pass stimulations as markers which would help me later when reviewing the output. Markers would capture events within an audio, e.g. started intro, started induction, started affirmation, started awakening etc. I have the time codes pre-entered into js so, for example, it will always send a stimulation event when I reach 1:10 of abc.mp3 and so on.

I had a question about getting specific values values to show up in the csv file which captures the signal and events.

I see from your example on this page (http://openvibe.inria.fr/csv-file-format-description/) that the event ID output in the file is expected to be clean and short. e.g:
0.25000,0,-20.20,-10.10,0.0,10.10,20.20,32000:32010,0.25000:0.25000,0:0

I am able to get my stimulations to show up in the csv/ov at approx the right time (which is what i need), but the values that show up are really confusing. I am using js so I just used the sample code in (http://openvibe.inria.fr/pub/src/extra/ ... ender.java), put that in an online java tool and it generated the array based on the value of the event ID. That allowed me to visualize what AS was expecting to get. To make my life simple, now I just send an array directly at each event using a client.write function to the acquisition server.

So if I use client.write('0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0'), the CSV always shows me this value of the event id at all the various timestamps.
35.5781250000,17,1.7324779034,1.3920503855,-1.2412731647,-0.9286367297,3467820298285101088,35.5852072134,0.0000000000

So my questions are:
1) what do I need to pass in the array such that it would show me one of standard OpenViBE stimulation codes? I would like to be able to get the values shown here (http://openvibe.inria.fr/stimulation-codes/) so that I could then consistently use values across tracks e.g. use OVTK_StimulationId_Label_2A for all inductions and say use OVTK_StimulationId_Label_17 as the marker when an audio track ends.

2) When I was using a unique array for each stimulation, I noticed that sometimes the event value would get recorded with multiple ids separated with a ':' . I read that it means "Events are recorded as numbers, several events can be present on the same line (timestamp) separated by colons." Does that indicate that my code sent more than one event at the same time? That would be pretty strange since that was not the intention. Is there anything I can do to avoid this?

Many thanks in advance,

Thibaut
Posts: 264
Joined: Wed Oct 31, 2018 9:14 am

Re: Passing values for stimulations

Post by Thibaut »

Hello,
I'll start at the end the answer is easy, yes if you have several events, they are separated by a ":".
You have the times also separated by a ":". If the time is identical it is indeed that you sent two stimulations at the same time. If the time is different it is because you had two separate stimulations but too close to be on two different lines.
But solving the first problem could solve the second, it's MAYBE because you have send a strange stimulation.^^

Regarding the number you receive I do not like JavaScript too much so I do not know its stubilities.^^
It is possible that what you send is bizarrely formatted (32bits/64bits, decimal/hexadecimal...). Try to send a number between 0 and 9 then send a number between 10 and 16. Then put a stimulation listener in OpenViBE to know if the numbers match. It is possible that you send a character string and not a number and He try to convert this and fail.
For example, OVTK_StimulationId_Label_2A send 0x0000812a (this is the hexadecimal value) or 33066 (this is the decimal value)

Thibaut

slightly
Posts: 5
Joined: Sun Dec 29, 2019 4:04 pm

Re: Passing values for stimulations

Post by slightly »

Greetings Thibaut,

Hmm, yes, it is very strange that it is sending more than one event. I am using a time range between the time i want in seconds and .3 seconds later to trigger an event (since I cant get it to trigger on exact time = X seconds). Maybe the code is checking twice in that window at times and that triggers a second event.

Yeah, i dont know Javascript either :) . I will play around with passing the hex value and the full number itself and see what that results in.

Thanks for the reply

slightly
Posts: 5
Joined: Sun Dec 29, 2019 4:04 pm

Re: Passing values for stimulations

Post by slightly »

Hi again Thibaut!

I have been trying to pass different versions of the string but cannot decipher a pattern that relates to anything. I have confirmed that I have to pass a string within ' ' s; passing numbers or an array without ' 's results in the stimulation being ignored.

Some sample of input and ouput are here https://pastebin.com/7AV54NWi

Would like to get your input from a program perspective ignoring Java or Javascript being the language used to communicate with AS. If I wanted to register a stimulation of e.g 33066 in the OV file or the CSV file, sent over a TCP connection in OpenVibe 2.2.0 (64BIT) , what character/string/array should I pass to the Acquisition Server once the connection is established?

thanks

Thibaut
Posts: 264
Joined: Wed Oct 31, 2018 9:14 am

Re: Passing values for stimulations

Post by Thibaut »

Hi,
I have never test but You cna find some documentation here : http://openvibe.inria.fr/overview-sendi ... -openvibe/
Thibaut

slightly
Posts: 5
Joined: Sun Dec 29, 2019 4:04 pm

Re: Passing values for stimulations

Post by slightly »

Hi Thibaut,

The doc you linked was good for understanding. I then went back to the python example and tried that out. It worked with a bit of modification, but i didnt want to use it since the other stuff i have put together is JS. So, I then spent some time understanding how to make a buffer in JS and write that to the AS (as I mentioned earlier, I was sending a character string over TCP).

With some trial and error I figured out the correct encoding and got it to work so am now able to send e.g. 33277 and it shows up as 33277 in my CSV as well as in Stimulation Listener box in Designer (with the correct label of OVTK_StimulationId_Label_FD)

regards

Mayukh
Posts: 1
Joined: Mon Jan 17, 2022 3:11 pm

Re: Passing values for stimulations

Post by Mayukh »

slightly wrote:
Tue Jan 14, 2020 9:41 pm
Hi Thibaut,

The doc you linked was good for understanding. I then went back to the python example and tried that out. It worked with a bit of modification, but i didnt want to use it since the other stuff i have put together is JS. So, I then spent some time understanding how to make a buffer in JS and write that to the AS (as I mentioned earlier, I was sending a character string over TCP).

With some trial and error I figured out the correct encoding and got it to work so am now able to send e.g. 33277 and it shows up as 33277 in my CSV as well as in Stimulation Listener box in Designer (with the correct label of OVTK_StimulationId_Label_FD)

regards
Hi. I'm also using a JavaScript application to send stimulations to the OpenVibe AS. But I'm still stuck at the encoding part. Could you tell me what buffer encoding works correctly? I've tried out a lot of buf.write() variations but none of them worked. Thanks!

Post Reply