How to add audio feedback just for wrong responses to an ongoing screen

112 views
Skip to first unread message

Hasan Gündüz

unread,
Oct 29, 2021, 5:15:21 PM10/29/21
to E-Prime
Hello to Everyone,
I did a quick scan of the issue I wanted to consult, but couldn't find a clear answer. Maybe I overlooked it. Please excuse me if I repeat.
As part of my thesis, I am designing an experiment. I have a Slide object that stays on the screen for a fixed time. The participant will be expected to react to this object as quickly as possible. The slide object will not disappear with the response, but if the response is wrong, there will be a feedback. The screen is not terminated by response but I couldn't add the feedback sound.
In sum, 
What I want to give a beep sound as feedback when the participant reacts incorrectly to this screen, as soon as they respond. There will be no feedback for correct responses.
I am not experienced with Eprime. I hope with your help I will be able to solve this problem.

Thank you in advance for your support.
Hasan Gunduz

McFarlane, David

unread,
Nov 1, 2021, 12:11:58 PM11/1/21
to e-p...@googlegroups.com
Hasan,

Playing the incorrect-response sound immediately upon an incorrect response but without affecting the timing of the stimulus Slide does get a little tricky. I can think of several approaches, all use a bit of InLine code. In one approach you would terminate the stimulus Slide upon a response and use an If-Then to control the feedback sound. I think most ordinary users would naturally head toward this approach, and it seems suitable for this case. In another approach, the InLine code itself would wait for a response, and then continue as above. In yet another approach, we would also play the feedback sound directly within the InLine code instead of using a SoundOut object in the structure. And in yet another approach, using E-Prime 3 you might do this using Script Task Events.

Let's look at the first approach.

Procedure structure:
- TrialProc
--- StimSlide
--- RespCode
--- IncorrectSound
--- PostIncorrectLabel

StimSlide is the stimulus Slide, with some specified Duration. On its input mask, provide an appropriate entry for "Correct" and set End Action to "Terminate". In order to run some InLine code based on the response, set PreRelease to 0 (otherwise I would leave it at "(same as duration)" -- please see other threads for more discussion of this detail).

RespCode holds some InLine code, as follows:
If StimSlide.ACC Then Goto PostIncorrectLabel
This will skip past the feedback sound in the event of a correct response.

IncorrectSound plays the incorrect-response sound, unless RespCode skips past this. Set Duration to 0, Stop After to "No", and End Sound Action to "(none)".

PostIncorrectLabel is a Label object, to serve as a destination for the Goto back in RespCode.

-- David McFarlane

________________________________________
From: e-p...@googlegroups.com <e-p...@googlegroups.com> on behalf of Hasan Gündüz <hasangu...@gmail.com>
Sent: Friday, October 29, 2021 5:15 PM
To: E-Prime
Subject: How to add audio feedback just for wrong responses to an ongoing screen

David McFarlane

unread,
Nov 2, 2021, 10:44:29 AM11/2/21
to Hasan Gündüz, E-Prime L i s t
[Note: Hasan wrote me off-list to point out that the instructions that
I posted do not succeed in playing the incorrect-feedback sound within
the StimSlide duration.]

Hasan,

Oops. I initially wrote instructions to extend the time for the
StimSlide after a response. Then I worried about the IncorrectSound
separately extending the time for the StimSlide. Then I remembered that
we could set IncorrectSound to Duration 0 and have it play while other
things continued to run. Then I had a brain fart and deleted my
instructions for extending the time of StimSlide after a response!
Sorry, of course that is the detail where you got stuck and posted your
question in the first place.

So, we could handle this a couple of ways: Add a Wait object at the
end, along with some InLine code to adjust the Duration of the Wait as
needed; or use a bit of InLine code to directly adjust the starting time
for whatever object runs next after the end of TrialProc so that that
object starts at the same time as if no response had come. The first
approach seems more natural to most E-Prime users, but the second
approach handles the timing much more cleanly. I will show the second
approach.

So add another InLine at the end of TrialProc:

Procedure structure:
- TrialProc
--- StimSlide
--- RespCode
--- IncorrectSound
--- PostIncorrectLabel
--- TrialFinishCode

TrialFinishCode holds some InLine code, as follows:
SetNextTargetOnsetTime StimSlide.OnsetTime + StimSlide.Duration
See the SetNextTargetOnsetTime topic in the E-Basic Help for details.
Of course this assumes that you want the timing to act like Event timing
mode. If you want it to act like Cumulative timing mode you would
instead use
SetNextTargetOnsetTime StimSlide.TargetOnsetTime + StimSlide.Duration

One more reminder: For the input mask on StimSlide, you have to set End
Action to "Terminate" so that it will play the IncorrectSound
immediately after an incorrect response. If you instead had End Action
set to "(none)" then you would have to wait the full Duration of
StimSlide before getting the incorrect-feedback sound.

OK, I hope that I got it all right this time, thank you for pursuing this!

-- David McFarlane


On 2021-11-01 Mon 4:51 PM, Hasan Gündüz wrote:
> Dear David McFarlane
>
> I followed your first suggestion and was able to add audio feedback
> tofalse responses. Thank you very much for this suggestion. However, in
> this case, I have to wait for the StimSlide object to terminate in order
> to hear the feedback sound. Is there a way to provide the feedback as
> soon as the participant responds before this object terminates, ie
> whilethe StimSlide object is still active?
>
> Sincerely
> Hasan Gunduz
>
> McFarlane, David <mcfa...@msu.edu <mailto:mcfa...@msu.edu>>, 1 Kas
> 2021 Pzt, 19:11 tarihinde şunu yazdı:
> From: e-p...@googlegroups.com <mailto:e-p...@googlegroups.com>
> <e-p...@googlegroups.com <mailto:e-p...@googlegroups.com>> on
> behalf of Hasan Gündüz <hasangu...@gmail.com
> <mailto:hasangu...@gmail.com>>

Hasan Gündüz

unread,
Nov 2, 2021, 5:19:19 PM11/2/21
to E-Prime
Dear McFarlane
I have added a trialFinish inline code and changed the End Action of StimSlide to Terminate as you suggested, and it worked! 
Thank you for this very fast and helpful solution.

Sincerely
Hasan Gunduz

2 Kasım 2021 Salı tarihinde saat 17:44:29 UTC+3 itibarıyla McFarlane, David şunları yazdı:
Reply all
Reply to author
Forward
0 new messages