control when to stop a sound stimulus


Author
Message
nakayama
nakayama
Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)
Group: Forum Members
Posts: 72, Visits: 408
Thank you Dave! this scrip helped a lot!
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
Store positions etc. in global variables (<values> entries), reference those as needed:

<values>
/ s1h = 0
/ s1v = 0
/ s1onset = 0
/ s1duration = 0
/ s2h = 0
/ s2v = 0
/ s2onset = 0
/ s2duration = 0
</values>

<list onsets>
/ items = (2000,2500,3000,3500,4000,4500)
/ selectionrate = always
</list>

<list duration>
/ items = (100,200,300,400,500,600)
/ selectionrate = always
</list>

<list h>
/ items = (20%, 40%, 60%, 80%)
/ selectionrate = always
</list>

<list v>
/ items = (20%, 30%, 40%, 50%, 60%, 70%, 80%)
/ selectionrate = always
</list>

<block someblock>
/ trials = [1-10=sometrial]
</block>

<trial sometrial>
/ ontrialbegin = [values.s1h=list.h.nextvalue; values.s1v=list.v.nextvalue;
    values.s1onset=list.onsets.nextvalue; values.s1duration=list.duration.nextvalue;

    values.s2h=list.h.nextvalue; values.s2v=list.v.nextvalue;
    values.s2onset=list.onsets.nextvalue; values.s2duration=list.duration.nextvalue; ]
/ ontrialbegin = [trial.sometrial.insertstimulustime(shape.s1, values.s1onset);
    trial.sometrial.insertstimulustime(shape.e1, values.s1onset+values.s1duration);

    trial.sometrial.insertstimulustime(shape.s2, values.s2onset);
    trial.sometrial.insertstimulustime(shape.e2, values.s2onset+values.s2duration); ]

/ ontrialend = [trial.sometrial.resetstimulusframes(); list.h.reset(); list.v.reset(); list.duration.reset(); list.onsets.reset(); ]

/ stimulusframes = [1=info]
/ validresponse = (57)

</trial>

<shape s1>
/ shape = rectangle
/ color = red
/ size = (100px, 100px)
/ hposition = values.s1h
/ vposition = values.s1v
</shape>

<shape e1>
/ shape = rectangle
/ color = white
/ size = (100px, 100px)
/ hposition = values.s1h
/ vposition = values.s1v
</shape>

<shape s2>
/ shape = circle
/ color = green
/ size = (100px, 100px)
/ hposition = values.s2h
/ vposition = values.s2v
</shape>

<shape e2>
/ shape = circle
/ color = white
/ size = (100px, 100px)
/ hposition = values.s2h
/ vposition = values.s2v
</shape>

<text info>
/ items = ("S1: Onset = <%values.s1onset%> | Duration = <%values.s1duration%> | X = <%values.s1h%> | Y = <%values.s1v%>
~nS2: Onset = <%values.s2onset%> | Duration = <%values.s2duration%> | X = <%values.s2h%> | Y = <%values.s2v%>")
/ position = (50%, 5%)
/ erase = false
/ size = (90%, 5%)
</text>


nakayama
nakayama
Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)
Group: Forum Members
Posts: 72, Visits: 408
Thank you for your reply. It works when the position of stimulus was set fixed. However, when the position was set according to a list:

...
/hposition=list.hpos1.nextvalue
/vposition=list.vpos1.nextvalue

How should I set the position of
if I want to erase shape 1?
It didn't erase shape1 if I input:

/hposition=shape.1.hposition
/vposition=shape.1.vposition
And input insertstimulus(shape.erase,list.eraseduration.nextvalue) under the same ontrislbegin with shape1


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
Yes, and it works exactly like what you've already done. You've used the insertstimulustime() function to display your target(s) at a random onsets. You only need to do the exact same thing for the stimuli that erase the respective target(s).

Nakayama Yao
Nakayama Yao
Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)Distinguished Member (4.1K reputation)
Group: Forum Members
Posts: 39, Visits: 230
Hi, Dave. 
I am wondering whether it is possible to track the position of the target, and erase it at random stimulustime, given that its position and onset varies randomly?  
So that they can appear and be erased randomly.
I guess should I use ontrialbegin? Thank you.

<list erase>
/ items = (2500,2600,2700,2800,2900)
/ selectionmode=random
/ selectionrate = always
</list>

<list targetduration>
/ items = (2100,2200,2300,2400,2500)
/ selectionmode=random
/ selectionrate = always
</list>
<trial timepresent1>
...
/ ontrialend = [trial.timepresent1.resetstimulusframes(); list.targetduration.reset(); ]
</trial>  

             

nakayama
nakayama
Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)
Group: Forum Members
Posts: 72, Visits: 408
As always, thank you, Dave.
Best,
nakayama
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
If you need to sample more than one value from a <list> in a given <trial>, you need to set its /selectionrate to always. The default is trial. Details can be found in the documentation for the /selectionrate attribute.

<list targetduration>
/ items = (2100,2200,2300,2400,2500)
/ selectionmode=random
/ selectionrate = always
</list>

You'll also have to think about resetting the list before it runs out of items (you are sampling without replacement). You'll want to do

<trial timepresent1>
...
/ ontrialend = [trial.timepresent1.resetstimulusframes(); list.targetduration.reset(); ]
</trial>                               
nakayama
nakayama
Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)
Group: Forum Members
Posts: 72, Visits: 408
Hi, Dave.
Sorry for asking again.
Following your advice, I made this:
However, onset of items appears synchronous, is there a way to varying them using the values from list?

<list targetduration>
/ items = (2100,2200,2300,2400,2500)
/ selectionmode=random
</list>

<trial timepresent1>
/ ontrialbegin = [trial.timepresent1.setstimulustime(shape.dot2,list.targetduration.nextvalue);
trial.timepresent1.insertstimulustime(shape.dot3,list.targetduration.nextvalue);
trial.timepresent1.insertstimulustime(shape.dot4,list.targetduration.nextvalue)]
/ stimulustimes = [0=fixation;2000=erase]
/ timeout = 2900
/ ontrialend = [trial.timepresent1.resetstimulusframes()]
</trial>
nakayama
nakayama
Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)Guru (5.2K reputation)
Group: Forum Members
Posts: 72, Visits: 408
Thank you Dave. Very appreciated for your advice.
The one for normal distribution generation appears complicated to comprehend so I decide to use discrete stimuli to approximate Gaussian.
Looking forward Inquisit to have some functions like norm().
Best,
nakayama



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 104K
Regarding your first question (sampling values from a normal distribution), see https://www.millisecond.com/forums/Topic8431.aspx

Regarding randomizing the onset of the stimulus, your syntax is invalid. You need to use the trial elements setstimulustime() function. See e.g. https://www.millisecond.com/forums/Topic11671.aspx as well as the language reference for setstimulustime(), resetstimulusframes(), etc.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search