Millisecond Forums

Help - the audio stimulus goes away after the first trial

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

By maya_mcg - 11/11/2020

Hello! 

I would like both my visual and audio stimulus to continue after the first trial, into the second and third trial. The visual stimulus (waldo) does stay through the trials. My audio stimulus, although it also has the setting 'erase = false' stops playing after the first trial. 
Does anyone know how to fix this? Below is my code for these trials:

<item waldo>
/ 1 = "wwr_1.png"
/ 2 = "WWr_2.png"
/ 3 = "WWr_3.png"
/ 4 = "WWr_4.png"
/ 5 = "WWr_5.png"
</item>

<picture waldo>
/ items = waldo
/ select = noreplace
/ position = (50%, 50%)
/ erase = false
/ size = (70%, 70%)
/ resetinterval = 0
</picture>

<item scream>
/1 = "one.wav"
/2 = "twoEnd.wav"
/3 = "three.wav"
/4 = "four.wav"
/5 = "five.wav"
/6 = "six.wav"
/7 = "seven.wav"
/8 = "eight.wav"
/9 = "nine.wav"
/10 = "ten.wav"
</item>

<sound scream>
/ items = scream
/ select = replace
/ erase = false
/ volume = 0
</sound>

<block example>
/ onblockbegin = [
    values.attempts_left = 3;
    values.circle_x = -10%;
    values.circle_y = -10%;
]
/ timeout = 20000
/ trials = [
    1=first;
]
</block>

<values>
/ attempts_left = 0
/ circle_x = 0%
/ circle_y = 0%
</values>

<trial first>
/ stimulusframes = [1=waldo, scream, circle, attempts]
/ inputdevice = mouse
/ validresponse = (waldo)
/ branch = [
    if (trial.first.response !=0 && trial.first.error) {
        values.attempts_left -= 1;
        values.circle_x = 1px*trial.first.responsex;
        values.circle_y = 1px*trial.first.responsey;
        return trial.second;
    }
]
</trial>

<trial second>
/ stimulusframes = [1=circle, attempts]
/ inputdevice = mouse
/ validresponse = (waldo)
/ branch = [
    if (trial.second.response != 0 && trial.second.error) {
        values.attempts_left -= 1;
        values.circle_x = 1px*trial.second.responsex;
        values.circle_y = 1px*trial.second.responsey;
        return trial.third;
    }
]
</trial>

<trial third>
/ stimulusframes = [1=circle, attempts]
/ inputdevice = mouse
/ validresponse = (waldo)
/ branch = [
    if (trial.third.response != 0 && trial.third.error) {
        values.attempts_left -= 1;
        values.circle_x = 1px*trial.third.responsex;
        values.circle_y = 1px*trial.third.responsey;
        return trial.end;
    }
]
</trial>


<trial end>
/ stimulusframes = [1=circle, attempts]
/ trialduration = 500
</trial>

<picture circle>
/ items = ("/Users/mayamcgregor/Desktop/circle.png")
/ erase = false
/ hposition = values.circle_x
/ vposition = values.circle_y
/ size = (5%, 5%)
</picture>

<text attempts>
/ items = ("You have <%values.attempts_left%> attempts left.")
/ position = (50%, 5%)
/ size = (30%, 10%)
/ erase = false
</text>

By Dave - 11/11/2020

maya_mcg - 11/11/2020
Hello! 

I would like both my visual and audio stimulus to continue after the first trial, into the second and third trial. The visual stimulus (waldo) does stay through the trials. My audio stimulus, although it also has the setting 'erase = false' stops playing after the first trial. 
Does anyone know how to fix this? Below is my code for these trials:

<item waldo>
/ 1 = "wwr_1.png"
/ 2 = "WWr_2.png"
/ 3 = "WWr_3.png"
/ 4 = "WWr_4.png"
/ 5 = "WWr_5.png"
</item>

<picture waldo>
/ items = waldo
/ select = noreplace
/ position = (50%, 50%)
/ erase = false
/ size = (70%, 70%)
/ resetinterval = 0
</picture>

<item scream>
/1 = "one.wav"
/2 = "twoEnd.wav"
/3 = "three.wav"
/4 = "four.wav"
/5 = "five.wav"
/6 = "six.wav"
/7 = "seven.wav"
/8 = "eight.wav"
/9 = "nine.wav"
/10 = "ten.wav"
</item>

<sound scream>
/ items = scream
/ select = replace
/ erase = false
/ volume = 0
</sound>

<block example>
/ onblockbegin = [
    values.attempts_left = 3;
    values.circle_x = -10%;
    values.circle_y = -10%;
]
/ timeout = 20000
/ trials = [
    1=first;
]
</block>

<values>
/ attempts_left = 0
/ circle_x = 0%
/ circle_y = 0%
</values>

<trial first>
/ stimulusframes = [1=waldo, scream, circle, attempts]
/ inputdevice = mouse
/ validresponse = (waldo)
/ branch = [
    if (trial.first.response !=0 && trial.first.error) {
        values.attempts_left -= 1;
        values.circle_x = 1px*trial.first.responsex;
        values.circle_y = 1px*trial.first.responsey;
        return trial.second;
    }
]
</trial>

<trial second>
/ stimulusframes = [1=circle, attempts]
/ inputdevice = mouse
/ validresponse = (waldo)
/ branch = [
    if (trial.second.response != 0 && trial.second.error) {
        values.attempts_left -= 1;
        values.circle_x = 1px*trial.second.responsex;
        values.circle_y = 1px*trial.second.responsey;
        return trial.third;
    }
]
</trial>

<trial third>
/ stimulusframes = [1=circle, attempts]
/ inputdevice = mouse
/ validresponse = (waldo)
/ branch = [
    if (trial.third.response != 0 && trial.third.error) {
        values.attempts_left -= 1;
        values.circle_x = 1px*trial.third.responsex;
        values.circle_y = 1px*trial.third.responsey;
        return trial.end;
    }
]
</trial>


<trial end>
/ stimulusframes = [1=circle, attempts]
/ trialduration = 500
</trial>

<picture circle>
/ items = ("/Users/mayamcgregor/Desktop/circle.png")
/ erase = false
/ hposition = values.circle_x
/ vposition = values.circle_y
/ size = (5%, 5%)
</picture>

<text attempts>
/ items = ("You have <%values.attempts_left%> attempts left.")
/ position = (50%, 5%)
/ size = (30%, 10%)
/ erase = false
</text>


Your only option is to display the sound via the <block>'s /bgstim, not via a trial.