OK this gives me something to work with ...
So on each trial the subject gets some stimulus. The stimulus remains for a fixed time whether or not the subject responds. For some stimuli the subject is to give no response, and for other stimuli the subject is to respond by pressing Space. Now you would like to play a beep at the time that the subject responds, without affecting the other timing.
If responses were to terminate the stimuli, or if you could play a beep after the stimulus times out, then you could simply follow the stimulus with a SoundOut object to play the beep. But to play the beep immediately after the response without affecting the stimulus timing does require some finesse.
I might do the following ...
My trial Procedure would look something like
- StimSlide
- FeedbackCode
- FeedbackSound
- PostFeedbackLabel
Since this is for MRI, I would set Timing Mode to "Cumulative" on each stimulus object (I explain this in my online E-Prime 2 course).
StimSlide presents the stimulus. Set PreRelease in this case to 0 (IMPORTANT!), so that the InLine code that follows does not run until the stimulus terminates. For the input mask, set Allowable to {SPACE}, Time Limit to "(same as duration)", and End Action to Terminate -- now when the subject responds with Space the Procedure will move on to FeedbackCode.
FeedbackCode runs InLine code as follows:
If StimSlide.RTTime Then
SetNextTargetOnsetTime StimSlide.TargetOnsetTime
Else
Goto PostFeedbackLabel
End If
Let's dissect that code a bit ...
"If StimSlide.RTTime" is just a compact way of saying "if the subject gave a response" (I could explain further if asked).
"SetNextTargetOnsetTime StimSlide.TargetOnsetTime" will make FeedbackSound behave as if it started at the same time as StimSlide, which will help us maintain our Procedure timing -- more on that below. (This assumes that you want the same effect as Cumulative timing mode -- if you wanted to enact Event timing mode, this line would instead read "SetNextTargetOnsetTime StimSlide.OnsetTime".)
"Goto PostFeedbackLabel" will skip the FeedbackSound when the subject does not give a response.
Moving on ...
FeedbackSound is a SoundOut object that presents the feedback sound. Set its Duration to the same Duration as StimSlide (IMPORTANT!) In FeedbackCode we make FeedbackSound act as if it started when StimSlide started, and because we give FeedbackSound the same Duration, it will now automatically fill in the remaining time of the stimulus. Meanwhile, it will play the feedback sound. I would probably set Stop After to "No" so that it will always play the full sound. End Sound must be set to "(none)" to prevent FeedbackSound ending early!
Finally, PostFeedbackLabel is a lowly Label object, so that we can skip past the feedback sound when the subject does not give a response.
There are of course other ways to achieve your goal. E.g., instead of FeedbackSound you could use a FeedbackSlide with two SlideStates, one which plays a sound and one which does not, and then your FeedbackCode would set an attribute to determine which SlideState to present, as well as fix the timing for the FeedbackSlide as above, but in this case you would not need a Goto or a Label -- I leave this as an exercise. But I think that the approach that I gave above requires a little less advanced knowledge.
I hope this helps.
Bonne chance,
-- David McFarlane