control when to stop a sound stimulus


Author
Message
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, Inquisit community,
Suppose I want to present a sound which lasts 3s, and I want it to stop at any point before the 3s . Which syntax should I use?
Best,
Nakayama
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
(*instead of using Timeout)
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
You should use either /timeout or /trialduration, set to a random value below 3 seconds.

<values>
/ randomduration = 0
</values>

<sound mysound>
/ items = ("threeseconds.wav")
/ playthrough = false
</sound>

<trial sometrial>
/ ontrialbegin = [values.randomduration = round(rand(10,2999))]
/ stimulusframes = [1=mysound]
/ validresponse = (0)
/ timeout = values.randomduration
</trial>

There is no other way to "stop" a sound once it's started playing.

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
Thank you for your advice, Dave.
Best,
nakayama 
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.
It is possible to let this random value drawn following a normal distribution with a certain fixed mean and standard deviation, say, 2000 and 40? So the timeout stop approximately 68% times within 2000+_40.
ontrialbegin = [values.randomduration = round(rand(10,2999))]
Best,
Nakayama
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
stimulustimes property

I am trying to randomize the onset (stimulustimes) of the stimulus using this syntax, but it seems not working.

<trial time>
/ ontrialbegin = [clear(trial.time.stimulustimes]
/ ontrialbegin = [setitem(trial.time.stimulustimes,shape.targetdot,list.targetduration.nextvalue)]
/ stimulustimes = [1=fixation;2000=targetdot]
/ timeout = 2900
</trial>
Is there a way to fix this?
Thank you.
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.

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



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>
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>                               
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search