Playing a sequence of images.


Author
Message
clarkm
clarkm
Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)
Group: Forum Members
Posts: 8, Visits: 159
Hi,

I am trying to create a simple task whereby each trial displays a series of 17 images in quick succession (so it plays like a video). I need the first, seventh and last frame to be held 2 seconds. I have been trying to do this for days an am completely stuck!

Please help me!
Charlotte 
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
clarkm - 3/20/2020
Hi,

I am trying to create a simple task whereby each trial displays a series of 17 images in quick succession (so it plays like a video). I need the first, seventh and last frame to be held 2 seconds. I have been trying to do this for days an am completely stuck!

Please help me!
Charlotte 

This can be done in a number of ways and should be fairly straightforward. What are you having trouble figuring out specifically

clarkm
clarkm
Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)
Group: Forum Members
Posts: 8, Visits: 159
I'm new to programming, so i apologise for my embarrassingly bad attempt, but this is as far as I got. I also tried playing around with lists, but couldn't find a working solution. How do I get it to play the sequence of images?!


<picture cig_apple_1>
/ items = ("cig_apple_grape_01.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_23456>
/ items = ("cig_apple_grape_06.PNG",
"cig_apple_grape_11.PNG",
"cig_apple_grape_16.PNG",
"cig_apple_grape_21.PNG",
"cig_apple_grape_26.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_7>
/ items = ("cig_apple_grape_31.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_end>
/ items = (
"cig_apple_grape_36.PNG",
"cig_apple_grape_41.PNG",
"cig_apple_grape_46.PNG",
"cig_apple_grape_51.PNG",
"cig_apple_grape_56.PNG",
"cig_apple_grape_61.PNG",
"cig_apple_grape_66.PNG",
"cig_apple_grape_71.PNG",
"cig_apple_grape_76.PNG",
"cig_apple_grape_81.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>


<trial cig_apple_grape>
/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]
/ validresponse = (0)
/ trialduration = 3300
/ pretrialpause = 100
/ posttrialpause = 2000
</trial>

<block myblock>
/ trials = [1 = cig_apple_grape]
</block>
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
clarkm - 3/20/2020
I'm new to programming, so i apologise for my embarrassingly bad attempt, but this is as far as I got. I also tried playing around with lists, but couldn't find a working solution. How do I get it to play the sequence of images?!


<picture cig_apple_1>
/ items = ("cig_apple_grape_01.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_23456>
/ items = ("cig_apple_grape_06.PNG",
"cig_apple_grape_11.PNG",
"cig_apple_grape_16.PNG",
"cig_apple_grape_21.PNG",
"cig_apple_grape_26.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_7>
/ items = ("cig_apple_grape_31.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_end>
/ items = (
"cig_apple_grape_36.PNG",
"cig_apple_grape_41.PNG",
"cig_apple_grape_46.PNG",
"cig_apple_grape_51.PNG",
"cig_apple_grape_56.PNG",
"cig_apple_grape_61.PNG",
"cig_apple_grape_66.PNG",
"cig_apple_grape_71.PNG",
"cig_apple_grape_76.PNG",
"cig_apple_grape_81.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>


<trial cig_apple_grape>
/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]
/ validresponse = (0)
/ trialduration = 3300
/ pretrialpause = 100
/ posttrialpause = 2000
</trial>

<block myblock>
/ trials = [1 = cig_apple_grape]
</block>

I'm having trouble making sense of that code. What exactly is the "sequence" you wish to display?

What your trial does is display one image at t0 (cig_apple_1)

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

one image at 1 second into the trial (cig_apple_23456)

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

one image (cig_apple_7) 100ms later, at 1100ms into the trial

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

and a final stimulus (cig_apple_end) two seconds later at 3100ms into the stimulus presentation sequence.

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

It makes no attempt whatsoever to display 17 images. To do that, you either need to set up 17 picture elements and spell out the exact time you want each of them displayed in /stimulustimes

or you can have the trial display a single <picture> element for X amount of time and run 17 trials of that.
clarkm
clarkm
Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)
Group: Forum Members
Posts: 8, Visits: 159
Dave - 3/20/2020
clarkm - 3/20/2020
I'm new to programming, so i apologise for my embarrassingly bad attempt, but this is as far as I got. I also tried playing around with lists, but couldn't find a working solution. How do I get it to play the sequence of images?!


<picture cig_apple_1>
/ items = ("cig_apple_grape_01.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_23456>
/ items = ("cig_apple_grape_06.PNG",
"cig_apple_grape_11.PNG",
"cig_apple_grape_16.PNG",
"cig_apple_grape_21.PNG",
"cig_apple_grape_26.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_7>
/ items = ("cig_apple_grape_31.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_end>
/ items = (
"cig_apple_grape_36.PNG",
"cig_apple_grape_41.PNG",
"cig_apple_grape_46.PNG",
"cig_apple_grape_51.PNG",
"cig_apple_grape_56.PNG",
"cig_apple_grape_61.PNG",
"cig_apple_grape_66.PNG",
"cig_apple_grape_71.PNG",
"cig_apple_grape_76.PNG",
"cig_apple_grape_81.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>


<trial cig_apple_grape>
/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]
/ validresponse = (0)
/ trialduration = 3300
/ pretrialpause = 100
/ posttrialpause = 2000
</trial>

<block myblock>
/ trials = [1 = cig_apple_grape]
</block>

I'm having trouble making sense of that code. What exactly is the "sequence" you wish to display?

What your trial does is display one image at t0 (cig_apple_1)

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

one image at 1 second into the trial (cig_apple_23456)

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

one image (cig_apple_7) 100ms later, at 1100ms into the trial

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

and a final stimulus (cig_apple_end) two seconds later at 3100ms into the stimulus presentation sequence.

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

It makes no attempt whatsoever to display 17 images. To do that, you either need to set up 17 picture elements and spell out the exact time you want each of them displayed in /stimulustimes

or you can have the trial display a single <picture> element for X amount of time and run 17 trials of that.
OK, thanks :-/

I guess I just figured 17 picture elements was such a long way of doing it that surely there must be a quicker way. I have 8 different "videos" of 17 frames that need to be shown, so didn't want the script to be longer than necessary. But if that is the correct way of doing it then so be it! 

Thanks for your help.


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
clarkm - 3/20/2020
Dave - 3/20/2020
clarkm - 3/20/2020
I'm new to programming, so i apologise for my embarrassingly bad attempt, but this is as far as I got. I also tried playing around with lists, but couldn't find a working solution. How do I get it to play the sequence of images?!


<picture cig_apple_1>
/ items = ("cig_apple_grape_01.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_23456>
/ items = ("cig_apple_grape_06.PNG",
"cig_apple_grape_11.PNG",
"cig_apple_grape_16.PNG",
"cig_apple_grape_21.PNG",
"cig_apple_grape_26.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_7>
/ items = ("cig_apple_grape_31.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_end>
/ items = (
"cig_apple_grape_36.PNG",
"cig_apple_grape_41.PNG",
"cig_apple_grape_46.PNG",
"cig_apple_grape_51.PNG",
"cig_apple_grape_56.PNG",
"cig_apple_grape_61.PNG",
"cig_apple_grape_66.PNG",
"cig_apple_grape_71.PNG",
"cig_apple_grape_76.PNG",
"cig_apple_grape_81.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>


<trial cig_apple_grape>
/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]
/ validresponse = (0)
/ trialduration = 3300
/ pretrialpause = 100
/ posttrialpause = 2000
</trial>

<block myblock>
/ trials = [1 = cig_apple_grape]
</block>

I'm having trouble making sense of that code. What exactly is the "sequence" you wish to display?

What your trial does is display one image at t0 (cig_apple_1)

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

one image at 1 second into the trial (cig_apple_23456)

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

one image (cig_apple_7) 100ms later, at 1100ms into the trial

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

and a final stimulus (cig_apple_end) two seconds later at 3100ms into the stimulus presentation sequence.

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

It makes no attempt whatsoever to display 17 images. To do that, you either need to set up 17 picture elements and spell out the exact time you want each of them displayed in /stimulustimes

or you can have the trial display a single <picture> element for X amount of time and run 17 trials of that.
OK, thanks :-/

I guess I just figured 17 picture elements was such a long way of doing it that surely there must be a quicker way. I have 8 different "videos" of 17 frames that need to be shown, so didn't want the script to be longer than necessary. But if that is the correct way of doing it then so be it! 

Thanks for your help.


As I said, the alternative is to just run 17 trials. Then you only need a single <picture> element and a couple of <list>s. Here's a quick example:

<values>
/ short = 200
/ long = 2000
/ duration = 0
/ count = 0
/ currentset = 0
</values>

<block example>
/ trials = [1-2 = start]
</block>

<trial start>
/ ontrialbegin = [
     values.currentset = list.selectset.nextvalue;
     values.count = 0;
]
/ stimulusframes = [1=clearscreen]
/ validresponse = (0)
/ trialduration = 0
/ branch = [
    trial.show;
]
</trial>

<trial show>
/ ontrialbegin = [
    values.duration = list.timings.nextvalue;
    values.count += 1;
]
/ stimulusframes = [1=image]
/ validresponse = (0)
/ trialduration = values.duration
/ branch = [
    if (values.count < 17) trial.show else trial.end
]
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, end]
/ validresponse = (57)
</trial>

<list timings>
/ items = (values.long,
    values.short, values.short, values.short, values.short, values.short,
    values.long,
    values.short, values.short, values.short, values.short, values.short,
    values.short, values.short, values.short, values.short,
    values.long)
/ selectionmode = sequence
/ selectionrate = always
</list>

<list selectset>
/ items = (1,2)
</list>

<list set1>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17)
/ selectionmode = sequence
</list>

<list set2>
/ items = (18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34)
/ selectionmode = sequence
</list>

<list setlist>
/ items = (list.set1.nextvalue, list.set2.nextvalue)
/ selectionmode = values.currentset
</list>


<text image>
/ items = imageitems
/ select = list.setlist.nextvalue
/ erase = false
</text>

<item imageitems>
/ 1 = "a01.jpg"
/ 2 = "a02.jpg"
/ 3 = "a03.jpg"
/ 4 = "a04.jpg"
/ 5 = "a05.jpg"
/ 6 = "a06.jpg"
/ 7 = "a07.jpg"
/ 8 = "a08.jpg"
/ 9 = "a09.jpg"
/ 10 = "a10.jpg"
/ 11 = "a11.jpg"
/ 12 = "a12.jpg"
/ 13 = "a13.jpg"
/ 14 = "a14.jpg"
/ 15 = "a15.jpg"
/ 16 = "a16.jpg"
/ 17 = "a17.jpg"

/ 1 = "b01.jpg"
/ 2 = "b02.jpg"
/ 3 = "b03.jpg"
/ 4 = "b04.jpg"
/ 5 = "b05.jpg"
/ 6 = "b06.jpg"
/ 7 = "b07.jpg"
/ 8 = "b08.jpg"
/ 9 = "b09.jpg"
/ 10 = "b10.jpg"
/ 11 = "b11.jpg"
/ 12 = "b12.jpg"
/ 13 = "b13.jpg"
/ 14 = "b14.jpg"
/ 15 = "b15.jpg"
/ 16 = "b16.jpg"
/ 17 = "b17.jpg"
</item>

<text end>
/ items = ("End of sequence. Press SPACE.")
</text>



Edited 4 Years Ago by Dave
clarkm
clarkm
Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)
Group: Forum Members
Posts: 8, Visits: 159
Dave - 3/20/2020
clarkm - 3/20/2020
Dave - 3/20/2020
clarkm - 3/20/2020
I'm new to programming, so i apologise for my embarrassingly bad attempt, but this is as far as I got. I also tried playing around with lists, but couldn't find a working solution. How do I get it to play the sequence of images?!


<picture cig_apple_1>
/ items = ("cig_apple_grape_01.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_23456>
/ items = ("cig_apple_grape_06.PNG",
"cig_apple_grape_11.PNG",
"cig_apple_grape_16.PNG",
"cig_apple_grape_21.PNG",
"cig_apple_grape_26.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_7>
/ items = ("cig_apple_grape_31.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>

<picture cig_apple_end>
/ items = (
"cig_apple_grape_36.PNG",
"cig_apple_grape_41.PNG",
"cig_apple_grape_46.PNG",
"cig_apple_grape_51.PNG",
"cig_apple_grape_56.PNG",
"cig_apple_grape_61.PNG",
"cig_apple_grape_66.PNG",
"cig_apple_grape_71.PNG",
"cig_apple_grape_76.PNG",
"cig_apple_grape_81.PNG")
/ select = sequence
/ size = (100%, 100%)
/ erase = false
</picture>


<trial cig_apple_grape>
/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]
/ validresponse = (0)
/ trialduration = 3300
/ pretrialpause = 100
/ posttrialpause = 2000
</trial>

<block myblock>
/ trials = [1 = cig_apple_grape]
</block>

I'm having trouble making sense of that code. What exactly is the "sequence" you wish to display?

What your trial does is display one image at t0 (cig_apple_1)

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

one image at 1 second into the trial (cig_apple_23456)

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

one image (cig_apple_7) 100ms later, at 1100ms into the trial

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

and a final stimulus (cig_apple_end) two seconds later at 3100ms into the stimulus presentation sequence.

/ stimulustimes = [0 = cig_apple_1; 1000 = cig_apple_23456; 1100 = cig_apple_7; 3100 = cig_apple_end]

It makes no attempt whatsoever to display 17 images. To do that, you either need to set up 17 picture elements and spell out the exact time you want each of them displayed in /stimulustimes

or you can have the trial display a single <picture> element for X amount of time and run 17 trials of that.
OK, thanks :-/

I guess I just figured 17 picture elements was such a long way of doing it that surely there must be a quicker way. I have 8 different "videos" of 17 frames that need to be shown, so didn't want the script to be longer than necessary. But if that is the correct way of doing it then so be it! 

Thanks for your help.


As I said, the alternative is to just run 17 trials. Then you only need a single <picture> element and a couple of <list>s. Here's a quick example:

<values>
/ short = 200
/ long = 2000
/ duration = 0
/ count = 0
/ currentset = 0
</values>

<block example>
/ trials = [1-2 = start]
</block>

<trial start>
/ ontrialbegin = [
     values.currentset = list.selectset.nextvalue;
     values.count = 0;
]
/ stimulusframes = [1=clearscreen]
/ validresponse = (0)
/ trialduration = 0
/ branch = [
    trial.show;
]
</trial>

<trial show>
/ ontrialbegin = [
    values.duration = list.timings.nextvalue;
    values.count += 1;
]
/ stimulusframes = [1=image]
/ validresponse = (0)
/ trialduration = values.duration
/ branch = [
    if (values.count < 17) trial.show else trial.end
]
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, end]
/ validresponse = (57)
</trial>

<list timings>
/ items = (values.long,
    values.short, values.short, values.short, values.short, values.short,
    values.long,
    values.short, values.short, values.short, values.short, values.short,
    values.short, values.short, values.short, values.short,
    values.long)
/ selectionmode = sequence
/ selectionrate = always
</list>

<list selectset>
/ items = (1,2)
</list>

<list set1>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17)
/ selectionmode = sequence
</list>

<list set2>
/ items = (18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34)
/ selectionmode = sequence
</list>

<list setlist>
/ items = (list.set1.nextvalue, list.set2.nextvalue)
/ selectionmode = values.currentset
</list>


<text image>
/ items = imageitems
/ select = list.setlist.nextvalue
/ erase = false
</text>

<item imageitems>
/ 1 = "a01.jpg"
/ 2 = "a02.jpg"
/ 3 = "a03.jpg"
/ 4 = "a04.jpg"
/ 5 = "a05.jpg"
/ 6 = "a06.jpg"
/ 7 = "a07.jpg"
/ 8 = "a08.jpg"
/ 9 = "a09.jpg"
/ 10 = "a10.jpg"
/ 11 = "a11.jpg"
/ 12 = "a12.jpg"
/ 13 = "a13.jpg"
/ 14 = "a14.jpg"
/ 15 = "a15.jpg"
/ 16 = "a16.jpg"
/ 17 = "a17.jpg"

/ 1 = "b01.jpg"
/ 2 = "b02.jpg"
/ 3 = "b03.jpg"
/ 4 = "b04.jpg"
/ 5 = "b05.jpg"
/ 6 = "b06.jpg"
/ 7 = "b07.jpg"
/ 8 = "b08.jpg"
/ 9 = "b09.jpg"
/ 10 = "b10.jpg"
/ 11 = "b11.jpg"
/ 12 = "b12.jpg"
/ 13 = "b13.jpg"
/ 14 = "b14.jpg"
/ 15 = "b15.jpg"
/ 16 = "b16.jpg"
/ 17 = "b17.jpg"
</item>

<text end>
/ items = ("End of sequence. Press SPACE.")
</text>



Thank you for this, I will give it a try. Desperately trying to get some online studies running as all face-to-face lab experiments have been stopped. Hurray for Inquisit Web! :) 
clarkm
clarkm
Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)Associate Member (255 reputation)
Group: Forum Members
Posts: 8, Visits: 159
Hi again,

Further to my previous post, my task now plays the image sequences and I am trying to get it to play a tone (high or low) at the start of frame 17. However, this does not seem to work consistently. For example, in the script below, it will play the tone at the correct time on the first two trials, then on subsequent trials it plays the tone on every single frame.

My understanding is that because Inquisit works with objects, once you link the sound to the trial on frame 17, it stays there unless you remove it. I tried using these lines to remove the sound at the end of each trial, but with no success:
/ ontrialend = [if (values.count > 16) trial.cig_light.removestimulustime(0);]
/ ontrialend = [if (values.count > 16) trial.cig_light.clearstimulusframes();]

I also tried using sound-only video files (mp4) instead of sound files, as suggested in another post, with limited success. When I did this, the first two trials were fine, then on subsequent trials the sound played on the first, seventh and 17th frames (the frames with the longer durations).

I have attached a link to my script and relevant files, in case my description is not very clear. Any suggestions as to how I can fix this problem with the audio tones would be greatly appreciated.

Thank you!
Charlotte

https://www.dropbox.com/sh/1xw2mxvqjqd3g9j/AABI4-ZL41LjVO2Q2mOHmNj7a?dl=0  


**********************************************************************************
    DEFAULTS
**********************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ minimumversion = "5.0.0.0"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ inputdevice = mouse
/ screencolor = (0,0,0)
/ txbgcolor = black
/ txcolor = white
</defaults>

<values>
/ short = 30
/ long = 2000
/ duration = 0
/ count = 0
/ currentset = 0
</values>

**********************************************************************************
Lists
**********************************************************************************
<list timings>
/ items = (values.long,
  values.short, values.short, values.short, values.short, values.short,
  values.long,
  values.short, values.short, values.short, values.short, values.short,
  values.short, values.short, values.short, values.short,
  values.long)
/ selectionmode = sequence
/ selectionrate = always
</list>

<list selectset>
/ items = (1,2)
</list>

<list cig_apple>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17)
/ selectionmode = sequence
</list>

<list cig_light>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17)
/ selectionmode = sequence
</list>

<list blocks>
/ items = (trial.start1, trial.start2, trial.start3, trial.start4)
/ itemprobabilities = (0.25, 0.25, 0.25, 0.25)
/ poolsize = 8
/ resetinterval = 200
</list>
**********************************************************************************
Fixation screen
**********************************************************************************
<text fixation>
/ items = ("+")
/ color = (255, 255, 255)
/ txbgcolor = (0, 0, 0)
/ fontstyle = ("Arial", 60pt)
/ erase = false
</text>

**********************************************************************************
Stimuli
**********************************************************************************
<sound high>
/items = high
/playthrough = true
/select = noreplace
</sound>

<item high>
/1 = "wave_high_fr1000.wav"
</item>

<sound low>
/items = low
/playthrough = true
/select = noreplace
</sound>

<item low>
/1 = "wave_low_fr500.wav"
</item>

<picture cig_apple>
/ items = cig_apple
/ select = list.cig_apple.nextvalue
/ size = (100%, 100%)
/ erase = false
</picture>

<item cig_apple>
/1 = "cig_apple_grape_01.PNG"
/2 = "cig_apple_grape_06.PNG"
/3 = "cig_apple_grape_11.PNG"
/4 = "cig_apple_grape_16.PNG"
/5 = "cig_apple_grape_21.PNG"
/6 = "cig_apple_grape_26.PNG"
/7 = "cig_apple_grape_31.PNG"
/8 = "cig_apple_grape_36.PNG"
/9 = "cig_apple_grape_41.PNG"
/10 = "cig_apple_grape_46.PNG"
/11 = "cig_apple_grape_51.PNG"
/12 = "cig_apple_grape_56.PNG"
/13 = "cig_apple_grape_61.PNG"
/14 = "cig_apple_grape_66.PNG"
/15 = "cig_apple_grape_71.PNG"
/16 = "cig_apple_grape_76.PNG"
/17 = "cig_apple_grape_81.PNG"
</item>

<picture cig_light>
/ items = cig_light
/ select = list.cig_light.nextvalue
/ size = (100%, 100%)
/ erase = false
</picture>

<item cig_light>
/1 = "cig_light_notepad_01.PNG"
/2 = "cig_light_notepad_06.PNG"
/3 = "cig_light_notepad_11.PNG"
/4 = "cig_light_notepad_16.PNG"
/5 = "cig_light_notepad_21.PNG"
/6 = "cig_light_notepad_26.PNG"
/7 = "cig_light_notepad_31.PNG"
/8 = "cig_light_notepad_36.PNG"
/9 = "cig_light_notepad_41.PNG"
/10 = "cig_light_notepad_46.PNG"
/11 = "cig_light_notepad_51.PNG"
/12 = "cig_light_notepad_56.PNG"
/13 = "cig_light_notepad_61.PNG"
/14 = "cig_light_notepad_66.PNG"
/15 = "cig_light_notepad_71.PNG"
/16 = "cig_light_notepad_76.PNG"
/17 = "cig_light_notepad_81.PNG"
</item>

<text end>
/ items = ("End of sequence. Press SPACE.")
</text>

**********************************************************************************
Trials - High
**********************************************************************************

<trial start1>
/ ontrialbegin =
    [values.currentset = list.selectset.nextvalue;
  values.count = 0;]
/ stimulusframes = [1=clearscreen; 2 = fixation]
/ validresponse = (0)
/ trialduration = 1000
/ branch = [trial.cig_apple_high;]
</trial>

<trial cig_apple_high>
/ ontrialbegin =
    [values.duration = list.timings.nextvalue;
  values.count += 1;]
/ ontrialbegin = [if (values.count > 16) trial.cig_apple_high.insertstimulustime(sound.high, 0);]
/ stimulusframes = [1=cig_apple]
/ validresponse = (0)
/ trialduration = values.duration
/ branch = [if (values.count < 17) trial.cig_apple_high else trial.end]
</trial>


<trial start2>
/ ontrialbegin =
    [values.currentset = list.selectset.nextvalue;
  values.count = 0;]
/ stimulusframes = [1=clearscreen; 2 = fixation]
/ validresponse = (0)
/ trialduration = 1000
/ branch = [trial.cig_light_high;]
</trial>

<trial cig_light_high>
/ ontrialbegin =
    [values.duration = list.timings.nextvalue;
  values.count += 1;]
/ ontrialbegin = [if (values.count > 16) trial.cig_light_high.insertstimulustime(sound.high, 0);]
/ stimulusframes = [1=cig_light]
/ validresponse = (0)
/ trialduration = values.duration
/ branch = [if (values.count < 17) trial.cig_light_high else trial.end]
</trial>

**********************************************************************************
Trials - Low
**********************************************************************************

<trial start3>
/ ontrialbegin =
    [values.currentset = list.selectset.nextvalue;
  values.count = 0;]
/ stimulusframes = [1=clearscreen; 2 = fixation]
/ validresponse = (0)
/ trialduration = 1000
/ branch = [trial.cig_apple_low;]
</trial>

<trial cig_apple_low>
/ ontrialbegin =
    [values.duration = list.timings.nextvalue;
  values.count += 1;]
/ ontrialbegin = [if (values.count > 16) trial.cig_apple_low.insertstimulustime(sound.low, 0);]
/ stimulusframes = [1=cig_apple]
/ validresponse = (0)
/ trialduration = values.duration
/ branch = [if (values.count < 17) trial.cig_apple_low else trial.end]
</trial>

<trial start4>
/ ontrialbegin =
    [values.currentset = list.selectset.nextvalue;
  values.count = 0;]
/ stimulusframes = [1=clearscreen; 2 = fixation]
/ validresponse = (0)
/ trialduration = 1000
/ branch = [trial.cig_light_low;]
</trial>

<trial cig_light_low>
/ ontrialbegin =
    [values.duration = list.timings.nextvalue;
  values.count += 1;]
/ ontrialbegin = [if (values.count > 16) trial.cig_light_low.insertstimulustime(sound.low, 0);]
/ stimulusframes = [1=cig_light]
/ validresponse = (0)
/ trialduration = values.duration
/ branch = [if (values.count < 17) trial.cig_light_low else trial.end]
</trial>

<trial end>
/ stimulusframes = [1=clearscreen, end]
/ timeout = (5000)
/ inputdevice = keyboard
/ validresponse = (57)
</trial>

<block example>
/ trials = [1-8 = list.blocks]
</block>

Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
You need to *reset* the trials' stimulus presentation sequence /ontrialend to remove the sound stimulus. Any inserted stimuli will (and are supposed to) persist unless you tell the trial otherwise, i.e. any and all subsequent instances of the same trial object will display the inserted stimulus until you reset that trial object's stimulus presentation sequence to its original state.


**************************************************************************************************************
    DEFAULTS
**************************************************************************************************************
<defaults>
/ canvassize = (100%, 100%)
/ minimumversion = "5.0.0.0"
/ fontstyle = ("Arial", 3%, false, false, false, false, 5, 1)
/ inputdevice = mouse
/ screencolor = (0,0,0)
/ txbgcolor = black
/ txcolor = white
</defaults>

<values>
/ short = 30
/ long = 2000
/ duration = 0
/ count = 0
/ currentset = 0
</values>



**********************************************************************************************************
Lists
**********************************************************************************************************

<list timings>
/ items = (values.long,
  values.short, values.short, values.short, values.short, values.short,
  values.long,
  values.short, values.short, values.short, values.short, values.short,
  values.short, values.short, values.short, values.short,
  values.long)
/ selectionmode = sequence
/ selectionrate = always
</list>


<list selectset>
/ items = (1,2)
</list>

<list cig_apple>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17)
/ selectionmode = sequence
</list>

<list cig_light>
/ items = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17)
/ selectionmode = sequence
</list>

<list blocks>
/ items = (trial.start1, trial.start2, trial.start3, trial.start4)
/ itemprobabilities = (0.25, 0.25, 0.25, 0.25)
/ poolsize = 8
/ resetinterval = 200
</list>
**********************************************************************************************************
Eraser
**********************************************************************************************************
<shape eraser>
/ shape = rectangle
/ size = (100%, 100%)
/ erase = false
</shape>

**********************************************************************************************************
Fixation screen
**********************************************************************************************************

<text fixation>
/ items = ("+")
/ color = (255, 255, 255)
/ txbgcolor = (0, 0, 0)
/ fontstyle = ("Arial", 60pt)
/ erase = false
</text>

**********************************************************************************************************
Stimuli
**********************************************************************************************************
sound high>
/items = high
/playthrough = true
/select = noreplace
</sound>

item high>
/1 = "wave_high_fr1000.wav"
</item>

sound low>
/items = low
/playthrough = true
/select = noreplace
</sound>

item low>
/1 = "wave_low_fr500.wav"
</item>

<video high>
/items = high
/playthrough = true
/select = noreplace
</video>

<item high>
/1 = "wave_high_fr1000.mp4"
</item>

<video low>
/items = low
/playthrough = true
/select = noreplace
</video>

<item low>
/1 = "wave_low_fr500.mp4"
</item>



<picture cig_apple>
/ items = cig_apple
/ select = list.cig_apple.nextvalue
/ size = (100%, 100%)
/ erase = false
</picture>

<item cig_apple>
/1 = "cig_apple_grape_01.PNG"
/2 = "cig_apple_grape_06.PNG"
/3 = "cig_apple_grape_11.PNG"
/4 = "cig_apple_grape_16.PNG"
/5 = "cig_apple_grape_21.PNG"
/6 = "cig_apple_grape_26.PNG"
/7 = "cig_apple_grape_31.PNG"
/8 = "cig_apple_grape_36.PNG"
/9 = "cig_apple_grape_41.PNG"
/10 = "cig_apple_grape_46.PNG"
/11 = "cig_apple_grape_51.PNG"
/12 = "cig_apple_grape_56.PNG"
/13 = "cig_apple_grape_61.PNG"
/14 = "cig_apple_grape_66.PNG"
/15 = "cig_apple_grape_71.PNG"
/16 = "cig_apple_grape_76.PNG"
/17 = "cig_apple_grape_81.PNG"
</item>


<picture cig_light>
/ items = cig_light
/ select = list.cig_light.nextvalue
/ size = (100%, 100%)
/ erase = false
</picture>

<item cig_light>
/1 = "cig_light_notepad_01.PNG"
/2 = "cig_light_notepad_06.PNG"
/3 = "cig_light_notepad_11.PNG"
/4 = "cig_light_notepad_16.PNG"
/5 = "cig_light_notepad_21.PNG"
/6 = "cig_light_notepad_26.PNG"
/7 = "cig_light_notepad_31.PNG"
/8 = "cig_light_notepad_36.PNG"
/9 = "cig_light_notepad_41.PNG"
/10 = "cig_light_notepad_46.PNG"
/11 = "cig_light_notepad_51.PNG"
/12 = "cig_light_notepad_56.PNG"
/13 = "cig_light_notepad_61.PNG"
/14 = "cig_light_notepad_66.PNG"
/15 = "cig_light_notepad_71.PNG"
/16 = "cig_light_notepad_76.PNG"
/17 = "cig_light_notepad_81.PNG"
</item>

<text end>
/ items = ("End of sequence. Press SPACE.")
</text>

**********************************************************************************************************
Trials - High
**********************************************************************************************************

<trial start1>
/ ontrialbegin =
    [values.currentset = list.selectset.nextvalue;
  values.count = 0;]
/ stimulusframes = [1=clearscreen; 2 = fixation]
/ validresponse = (0)
/ trialduration = 1000
/ branch = [trial.cig_apple_high;]
</trial>

<trial cig_apple_high>
/ ontrialbegin =
    [values.duration = list.timings.nextvalue;
  values.count += 1;]
/ ontrialbegin = [if (values.count > 16) trial.cig_apple_high.insertstimulustime(video.high, 0);]
/ ontrialend = [trial.cig_apple_high.resetstimulusframes();]
/ stimulusframes = [1=cig_apple]
/ validresponse = (0)
/ trialduration = values.duration
/ branch = [if (values.count < 17) trial.cig_apple_high else trial.end]
</trial>


<trial start2>
/ ontrialbegin =
    [values.currentset = list.selectset.nextvalue;
  values.count = 0;]
/ stimulusframes = [1=clearscreen; 2 = fixation]
/ validresponse = (0)
/ trialduration = 1000
/ branch = [trial.cig_light_high;]
</trial>

<trial cig_light_high>
/ ontrialbegin =
    [values.duration = list.timings.nextvalue;
  values.count += 1;]
/ ontrialbegin = [if (values.count > 16) trial.cig_light_high.insertstimulustime(video.high, 0);]
/ ontrialend = [trial.cig_light_high.resetstimulusframes();]
/ stimulusframes = [1=cig_light]
/ validresponse = (0)
/ trialduration = values.duration
/ branch = [if (values.count < 17) trial.cig_light_high else trial.end]
</trial>

**********************************************************************************************************
Trials - Low
**********************************************************************************************************

<trial start3>
/ ontrialbegin =
    [values.currentset = list.selectset.nextvalue;
  values.count = 0;]
/ stimulusframes = [1=clearscreen; 2 = fixation]
/ validresponse = (0)
/ trialduration = 1000
/ branch = [trial.cig_apple_low;]
</trial>

<trial cig_apple_low>
/ ontrialbegin =
    [values.duration = list.timings.nextvalue;
  values.count += 1;]
/ ontrialbegin = [if (values.count > 16) trial.cig_apple_low.insertstimulustime(video.low, 0);]
/ ontrialend = [trial.cig_apple_low.resetstimulusframes();]
/ stimulusframes = [1=cig_apple]
/ validresponse = (0)
/ trialduration = values.duration
/ branch = [if (values.count < 17) trial.cig_apple_low else trial.end]
</trial>


<trial start4>
/ ontrialbegin =
    [values.currentset = list.selectset.nextvalue;
  values.count = 0;]
/ stimulusframes = [1=clearscreen; 2 = fixation]
/ validresponse = (0)
/ trialduration = 1000
/ branch = [trial.cig_light_low;]
</trial>

<trial cig_light_low>
/ ontrialbegin =
    [values.duration = list.timings.nextvalue;
  values.count += 1;]
/ ontrialbegin = [if (values.count > 16) trial.cig_light_low.insertstimulustime(video.low, 0);]
/ ontrialend = [trial.cig_light_low.resetstimulusframes();]
/ stimulusframes = [1=cig_light]
/ validresponse = (0)
/ trialduration = values.duration
/ branch = [if (values.count < 17) trial.cig_light_low else trial.end]
</trial>

**********************************************************************************************************
Trials - End
**********************************************************************************************************

<trial end>
/ stimulusframes = [1=clearscreen, end]
/ timeout = (5000)
/ inputdevice = keyboard
/ validresponse = (57)
</trial>

<block example>
/ trials = [1-8 = list.blocks]
</block>
Edited 4 Years Ago by Dave
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search