Christina,
I had a feeling that my first response was not quite right. I wrote &
posted in haste and failed to notice the flaw. Please scrap that first
answer, and try this one, which I actually tested to see that it works.
The solution I propose uses a bit of deep voodoo that would not occur
to most E-Prime users, but I will also suggest a simplification.
First, let's review the specifications for your Procedure:
- Play a sound, and get a response to that sound. The sound should
complete playback no matter what else happens.
- If response comes within 500 ms after the start of the sound, run out
the remainder of the 500 ms as if nothing happened, and skip past the
TextDisplay that follows the SoundOut.
- If response does not come within 500 ms after the start of the sound,
present a TextDisplay for some Duration.
- If response comes during the TextDisplay, terminate the TextDisplay.
Does that sound right?
Then set up your Procedure something like:
- StimSound
- PostStimText
- SoundRespLabel
- SoundWaitCode
- SoundWait
Set up each object as follows:
- StimSound: Stop After = No, Duration = 500, Time Limit as appropriate
(see "extended input"), End Action = "Jump", Jump Label =
"SoundRespLabel", logging to log the response. (Also see below for note
on timing mode.)
- PostStimText: PreRelease = 0 (so that SoundWaitCode will not run too
early). (All the other object may use PreRelease = "(same as
duration)", or whatever.)
- SoundRespLabel: (This is just a Label object, nothing to set up.)
- SoundWaitCode: This is where I use a bit of deep voodoo. Your code
may consist of a single line, thus,
SetNextTargetOnsetTime StimSound.OnsetTime
- SoundWait: (This is a Wait object) Duration = 500 (same as
StimSound), Timing Mode = Cumulative. Might as well also make sure that
Onset Sync = "(none)" (already the default setting in newer versions of EP).
- Whatever object runs after SoundWait (might be StimSound again):
Timing Mode = Event.
How this works:
If a response comes while StimSound runs, then the program jumps past
PostStimText and runs SoundWaitCode. And here is where the deep voodoo
comes into play. SoundWaitCode uses SetNextTargetOnsetTime to make
SoundWait think that it was supposed to start at the same time as
StimSound. Of course, SoundWait starts later than that, but that
doesn't matter. Because we also set SoundWait to use Cumulative timing
mode (the other bit of deep voodoo), it calculates its end time (and the
TargetOnsetTime of the next object) based on its own Duration (which we
set to the same Duration as StimSound) and the OnsetTime of StimSound.
As a result, SoundWait just takes up the remaining Duration of StimSound
as if nothing had happened, and everything moves on from there.
If a response comes during PostStimText, then the program jumps ahead to
run SoundWaitCode; if a response never comes, then the program just
moves ahead to run SoundWaitCode. In either case, once again
SoundWaitCode uses SetNextTargetOnsetTime to make SoundWait think that
it was supposed to start at the same time as StimSound. This time,
however, SoundWait actually starts later than its own projected ending
time (because SoundWait uses Cumulative timing mode)! No problem,
SoundWait sees that, does nothing, and the program simply moves on to
the next object. In this case, that next object must use Event timing
mode or else its own timing may be off (think it through).
Note the mix of Event & Cumulative timing mode. If your experiment does
not allow that, then you would have to modify this solution accordingly.
I leave that as an exercise. If you find all of this confusing, then
you might find it useful to take my online course.
How you might simplify this:
I used a mixture of SetNextTargetOnsetTime and Cumulative timing mode
because it makes the timing more precise, and I have a deep
understanding of E-Prime and how to use these features. Most ordinary
E-Prime users would not do this, and their programs would work plenty
well enough without my voodoo techniques. Instead, you could put code
in SoundWaitCode to simply recalculate the Duration of SoundWait based
on the current time and StimSound.OnsetTime, use that to set an
attribute, and then use that attribute for the Duration of SoundWait.
This is just a little less precise because it cannot quite account for
timing delays between the end of the InLine code and the onset of
SoundWait, but it would be Good Enough and probably easier to understand
and manage. I leave this as an exercise.
In any case, this does seem a bit complex. I don't know how this
compares to how you would do this in Presentation or PsyScope.
This turned out to be an interesting little puzzle, so thanks for posing
it. And again, please write back and let us know how this works for you.