Millisecond Forums

Sound with the error message in Stroop task

https://forums.millisecond.com/Topic19608.aspx

By dukanske - 8/29/2016

Hi,
I'm adapting the script for the color-word Stroop task for a study. One of the things I need to do is add a sound to the error message after wrong responses.
In the existing script, an "X" flashes after wrong responses. The stimulus is written as a text item. How do I get a sound to play simultaneously with the "X"?

Also, could I include several different error sounds with random selection to get an element of surprise with each error message? How?

I'll be very grateful for any help you can offer to resolve this.

Thanks,
Freddie
By Dave - 8/29/2016

You need to set up a <sound> element (if you're using WAV files) or a <video> element (if you are using some other audio format like MP3). That element can have multiple items. You then need to display it via the <trial>'s /responsemessage. One problem may be that a <trial> only may have a single /errormessage attribute (not multiple). You may thus have to /branch to a dedicated feedback trial instead of using /errormessage and/or /responsemessage. That feedback trial can display both the X <text> stimulus and the <sound>/<video> as any other trial would display any other stimuli.
By dukanske - 8/31/2016


Right, so the standard errormessage can only specify one stimulus. I guess I need to branch to a designated feedback trial as you suggest. However, after a few hours of fiddling around with this I can't seem to get it working. Where in the trial specification do I insert the /branch command, and how do I write the condition? The original trials are written as follows:

<trial redcongruent>
/ontrialbegin = [
    values.congruency = 1;
]
/ pretrialpause = 200
/ stimulustimes = [1=redcongruent, redreminder, greenreminder, bluereminder, blackreminder]
/ correctresponse = ("d")
/ validresponse = ("d", "f", "j", "k")
/ errormessage = true(x, 400)
/ontrialend = [
    list.responses.insertitem(trial.redcongruent.correct, 1);
    list.responses_congruent.insertitem(trial.redcongruent.correct, 1);

    if (trial.redcongruent.correct) {
        list.latencies.insertitem(trial.redcongruent.latency, 1);
        list.latencies_congruent.insertitem(trial.redcongruent.latency, 1);
    }
]
</trial>
By Dave - 8/31/2016

It doesn't matter where you insert the /branch. That would only matter if there were multiple /branch attributes in the <trial>: Then they are checked in the order given from top to bottom, with the first /branch that evaluates to 'true' being executed.

<trial redcongruent>
/ontrialbegin = [
    values.congruency = 1;
]
/ pretrialpause = 200
/ stimulustimes = [1=redcongruent, redreminder, greenreminder, bluereminder, blackreminder]
/ correctresponse = ("d")
/ validresponse = ("d", "f", "j", "k")
/ errormessage = true(x, 400)
/ontrialend = [
    list.responses.insertitem(trial.redcongruent.correct, 1);
    list.responses_congruent.insertitem(trial.redcongruent.correct, 1);

    if (trial.redcongruent.correct) {
        list.latencies.insertitem(trial.redcongruent.latency, 1);
        list.latencies_congruent.insertitem(trial.redcongruent.latency, 1);
    }
]
/ branch = [if (trial.redcongruent.error) trial.errorfeedback]
</trial>                               

with

<trial errorfeedback>
/ stimulusframes = [1=x, errorsound]
/ validresponse = (noresponse)
/ trialduration = 400
/ recorddata = false
</trial>
By dukanske - 8/31/2016

That's awesome, thank you!