controlling trial durations using timeout and responseinterrupt attirbutes


Author
Message
clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49

Hi!



I'm having a problem with controlling the duration of trials involving sounds and other stimuli. I hope somebody can give me a tip here.


I'm trying to write a script for a program that alternates between playing a sound and presenting a moment of silence (for sake of testing, I now filled the silence with two visual stimuli, just to play around with different parameters).


- Both the sound trial and the silence trial are supposed to last for different, randomly chosen durations, which I specified using the timeout attribute.


- Participants are supposed to respond by the sound/silence by pressing the space bar as soon as they detect it. I want the trial to continue after the response until the timeout duration is reached. I used the responseinterrupt attribute for that.


My problem is that neither the timeout nor the responseinterrupt attribute function like I want them to. On sound trials, the sound always plays the full length of the .wav file (about 1 minute), regardless of the timeout and regardless of whether a response is entered or not. On silence trials, the trial is always aborted as soon as a response is entered. Any idea what could be going wrong here?



Thanks in advance!



Here is my script:


<sound rainsound>
/ items = ("rain.wav")
/ volume = -1000
/ erase = true
</sound>

<shape soundshape>
/ color = (0, 251, 231)
/ size = (20, 20)
/ erase = true (white)
</shape>
 
<shape nosound>
/ color = (255, 35, 117)
/ size = (20, 20)
/ erase = true (white)
</shape>

<counter tonetime>
/ select = noreplace(10000-59000)
</counter>

<counter silencetime>
/ select = noreplace(10000-59000)
</counter>



<trial toneon>
/ stimulusframes = [1=rainsound]
/ correctresponse = (57)
/ responseinterrupt = trial
/ timeout = (tonetime)
</trial>

<trial soundshape>
/ stimulustimes = [1=soundshape]
/ correctresponse = (57)
/ responseinterrupt = trial
/ timeout = (silencetime)
</trial>

<trial toneoff>
/ stimulustimes = [1=nosound]
/ correctresponse = (57)
/ responseinterrupt = trial
/ timeout = (silencetime)
</trial>


<block tones>
/ trials = [1-200 = sequence (toneoff, soundshape, toneon)]
</block>


<expt>
/ blocks = [1=tones]
</expt>


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: 108K

On silence trials, the trial is always aborted as soon as a response is entered.


If you don't want that, you need to use /trialduration, *not* /timeout. /responseinterrupt has nothing to do with this. Please see the "How to Control Trial Duration and Inter-Trial Intervals" topic in the documentation for details on those attributes, what they mean and how they are supposed to behave.


On sound trials, the sound always plays the full length of the .wav file (about 1 minute)


This is the expected behavior for /responseintterupt=trial. Quoting from the documentation:


/ responseinterrupt = mode


Parameters









modeOne of the following values:



















ValueDescription
immediateAny remaining stimulus presentation frames are aborted when the subject
responds, and the stimuli are immediately erased.
framesAny remaining frames in the trial are presented before the stimuli are
erased.
trialAny remaining frames in the trial are presented before the stimuli are
erased. Any media stimuli (sound or video) are played to completion before
Inquisit advances to the next trial.


It is unclear from your description whether you want the sound to *stop* upon registering a response or not. If yes, you need to use /trialduration (as already indicated above) and /responseinterrupt=immediate (the default). If the sound is supposed to keep playing for the specified duration regardless of a response having already occurred, you need to do something along the lines of


<sound rainsound>
/ items = ("rain.wav")
/ volume = -1000
/ erase = true
/ playthrough = false
</sound>
 
<shape blank>
/ color = (white)
/ size = (20, 20)
/ erase = true (white)
</shape>

<counter tonetime>
/ select = sequence(5000, 10000)
</counter>

<trial toneon>
/ ontrialbegin = [trial.toneon.insertstimulustime(shape.blank, counter.tonetime.selectedvalue)]
/ stimulustimes = [0=rainsound]
/ correctresponse = (57)
/ responseinterrupt = frames
/ trialduration = counter.tonetime.selectedvalue
/ responsetime = 0
</trial>

<block tones>
/ trials = [1-2 = sequence (toneon)]
</block>




clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49

Thanks, Dave!


Using trialduration instead of timeout indeed worked. I also understand now why responseinterrupt = trial wasn't right. However, responseinterrupt = frames doesn't quite do what I want either.


I want the sound/visual stimulus to continue after a response until the end of the trial. That is what happens now. The sound stops/the visual stimulus disappears and a blank screen remains until the end of the trial. I guess that makes some sense given the description of the frames value. "Any remaining frames in the trial are presented before the stimuli are
erased." In my trials, there is just one frame. After the response, that frame is apparently erased, and there aren't any "remaining frames":


<trial toneon>
/ stimulustimes = [0=rainsound]
/ correctresponse = (57)
/ responseinterrupt = frames
/ trialduration = counter.tonetime.selectedvalue
/ responsetime = 0
</trial>

<trial toneoff>
/ stimulustimes = [0=nosound]
/ correctresponse = (57)
/ responseinterrupt = frames
/ trialduration = counter.silencetime.selectedvalue
/ responsetime = 0
</trial>


(I adapted your proposed script a little, because I actually want the silence to be a real trial with an opportunity to respond just like for the sound).



I found out that adding another frame (see below) in principle solves the problem, but in practice brings up a new problem.


<trial toneon>
/ stimulustimes = [0=rainsound; 8000=rainsound]
/ correctresponse = (57)
/ responseinterrupt = frames
/ trialduration = (8000)
/ responsetime = 0
</trial>


This works if I know the value of the trialduration. If that is a variable, like it is in my case, I don't know what number to put in there for the second stimulus in the / stimulustimes. If I put in a number that is higher than the trialduration the sound will play for that duration, so the trial becomes longer than I want. If I give it a lower number I'm again stuck with a silence interval at the end of the trial. A construction with a variable (see below) gives me an error message.


<trial toneon>
/ stimulustimes = [0=rainsound; counter.tonetime.selectedvalue = rainsound]
/ correctresponse = (57)
/ responseinterrupt = frames
/ trialduration = (counter.tonetime.selectedvalue)
/ responsetime = 0
</trial>


Do you have any other ideas for this?


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: 108K

Claire,


the example code I posted in my previous reply already covers this and demonstrates how to insert a frame dynamically:


<trial toneon>


/ ontrialbegin = [trial.toneon.insertstimulustime(shape.blank, counter.tonetime.selectedvalue)]


/ ontrialend = [trial.toneon.resetstimulusframes()]


/ stimulustimes = [0=rainsound]
/ correctresponse = (57)
/ responseinterrupt = frames
/ trialduration = counter.tonetime.selectedvalue
/ responsetime = 0
</trial>


clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49

Sorry, I didn't understand that line. Why use interstimulustime here? And why the blank shape on a sound trial?


Also, with that line, the visual stimulus and the sound presentation overlap sometimes.


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: 108K

Why use interstimulustime here?


What else would one use? I don't understand your question.


And why the blank shape on a sound trial?


To have a frame at a dynamically determined point in time so stim presentation does not terminate upon response (that's what you want, isn't?).


Also, with that line, the visual stimulus and the sound presentation overlap sometimes.


Again, not sure what you are talking about. There is no visual stim in the code I posted, so please be more specific.


clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49


What else would one use? I don't understand your question.



I just don't understand what the interstimulustime does here. It's a time between stimuli, right? I have only one stimulus in the trial, so I don't understand what the interstimulustime will do.



There is no visual stim in the code I posted, so please be more specific.



No, but there was a blank shape in the code you posted. I colored that, and that's what I call the visual stimulus.


In my experiment, I want to have a trial with sound and a trial with silence (no stimulus), both of which require participants to respond. While test-running, I wanted to be able to distinguish, when I'm seeing a blank screen, whether it's a silent trial or whether it's a sound trial that is just not playing the sound. So I made a visual stimulus (shape.nosound). In your example trial, I replaced your blank shape with that visual stimulus. When I run it, I see the stimulus while hearing the sound, when they should alternate.


<trial toneon>
/ stimulustimes = [0=rainsound]
/ ontrialbegin = [trial.toneon.insertstimulustime(shape.nosound, counter.tonetime.selectedvalue)]
/ correctresponse = (57)
/ responseinterrupt = frames
/ trialduration = (counter.tonetime.selectedvalue)
/ responsetime = 0
</trial>



clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49

P.S., "When they should alternate" in my last post wasn't correct. My goal is to have them alternate as separate trials. Within a trial, there should always only be a sound OR no sound (blank shape/visual stimulus, whatever you want to call it).


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: 108K

I just don't understand what the interstimulustime does here. It's a time between stimuli, right?


No. It's *insert*stimulustime. It inserts the specified stimulus at the specified time and you can find further details in the documentation. You need that frame at that point in time, otherwise /responseinterrupt=frames is pointless: What would be there to interrupt?!


I replaced your blank shape with that visual stimulus. When I run it, I see the stimulus while hearing the sound, when they should alternate.


If you go back to the code for the <trial> element in my previous reply, you will find that you also have to reset stimulus presentation at the end of the trial. Again, details for the resetstimulusframes() function are available in the documentation.



clairez
clairez
Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)Guru (5K reputation)
Group: Forum Members
Posts: 41, Visits: 49

Ha, I guess I get it now, and I understand the confusion.


I think in your example trial you meant to type:


/ ontrialbegin = [trial.toneon.insertstimulustime(sound.rainsound, counter.tonetime.selectedvalue)]


rather than


/ ontrialbegin = [trial.toneon.insertstimulustime(shape.blank, counter.tonetime.selectedvalue)]


Is that it? That's why I asked


And why the blank shape on a sound trial?







Here my entire script now, and it seems to work exactly as intended. 


Thanks a lot for your help, Dave!





<sound rainsound>
/ items = ("rain.wav")
/ volume = -1000
/ erase = true
/ playthrough = false
</sound>
 
<shape nosound>
/ color = (255, 35, 117)
/ size = (20, 20)
/ erase = true (white)
</shape>

<counter tonetime>
/ select = sequence(500, 3000, 12000)
</counter>

<counter silencetime>
/ select = sequence(500, 3000, 12000)
</counter>


<trial toneon>
/ stimulustimes = [0=rainsound]
/ ontrialbegin = [trial.toneon.insertstimulustime(sound.rainsound, counter.tonetime.selectedvalue)]
/ correctresponse = (57)
/ responseinterrupt = frames
/ trialduration = (counter.tonetime.selectedvalue)
/ responsetime = 0
</trial>

<trial toneoff>
/ stimulustimes = [0=nosound]
/ ontrialbegin = [trial.toneoff.insertstimulustime(shape.nosound, counter.silencetime.selectedvalue)]
/ correctresponse = (57)
/ responseinterrupt = frames
/ trialduration = (counter.silencetime.selectedvalue)
/ responsetime = 0
</trial>


<block tones>
/ trials = [1-200 = sequence (toneon, toneoff)]
</block>


<expt>
/ blocks = [1=tones]
</expt>


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search