Replay stimulus multiple times in PsychoPy

269 views
Skip to first unread message

Charlotte Chen

unread,
Jun 14, 2014, 2:06:58 AM6/14/14
to psychop...@googlegroups.com
Hi!

I'm building an experiment where in each trial, the subjects can replay stimulus as many times as they wish by pressing certain keys. For example, there're 2 sounds: s1 and s2. s1 is associated with key 'a', and s2 is associated with key 'j'. Whenever the subject presses 'a', s1 will be played. Same for s2. Space bar is used to terminate the present trial and jump to the next trial.

Now I'm able to play stimulus after key press, by having '$event.getKeys('a')' in the condition field in s1 sound component, and '$event.getKeys('j')' in s2 sound component. But this will only play each stimulus once in a trial. The second time the keys are pressed, there are no sounds.

So my question is, what should I do so that in each trial, a stimulus can be played EACH time a designated key is pressed?

Thank you!

Michael MacAskill

unread,
Jun 15, 2014, 9:39:38 PM6/15/14
to psychop...@googlegroups.com
Hi,

This question was answered at StackOverflow <http://stackoverflow.com/questions/24217104/replay-stimulus-multiple-times-in-psychopy/24235505#24235505>

Ideally we should only ask any given question *either* on this mailing list, *or* on the web StackOverflow, to avoid duplication of effort by anyone providing an answer.

Cheers,

Michael

LisaLondon

unread,
Aug 25, 2015, 7:28:01 AM8/25/15
to psychopy-users
Hello,

just interested whether there has been any more development regarding the replay of sound files?
So for example, if my experiment automatically plays a sound and my participant wants to listen to it again by pressing a button (lets say space bar) to repeat it, is there now an easier way of doing this? To me this seems like it might be a common issue?
Thanks!

Michael MacAskill

unread,
Aug 25, 2015, 7:39:13 AM8/25/15
to psychop...@googlegroups.com

> On 25/08/2015, at 13:28, 'LisaLondon' via psychopy-users <psychop...@googlegroups.com> wrote:
>
> Hello,
>
> just interested whether there has been any more development regarding the replay of sound files?
> So for example, if my experiment automatically plays a sound and my participant wants to listen to it again by pressing a button (lets say space bar) to repeat it, is there now an easier way of doing this? To me this seems like it might be a common issue?
> Thanks!

If you want to do nothing other than what you describe above, then just create two sound components. One is set to start automatically at a specified time, and the other is set to start by condition, once a key has been pressed, as the previous person in this thread had done.

It is only if you want multiple replays that you would need to add the previously suggested code route. Does the restriction of starting a stimulus by condition only once still hold? I have no idea. Have you tried?

Regards,

Michael

LisaLondon

unread,
Aug 25, 2015, 8:19:45 AM8/25/15
to psychopy-users
Hi Michael,

yes it seems to be restricted to replaying it once, but for my purpose, thats totally fine. Thank you, I didn't realize it was that straight forward!

Martina Dašková

unread,
Jun 3, 2016, 10:05:16 PM6/3/16
to psychopy-users, michael....@otago.ac.nz

Hi,
I am sorry, I do not know how to use it for my experiment.

I have 3 trials and each trial has 50 sounds. The response is set to be infinite, after pressing a response key. I defined the response in conditions file (excel) under the $corrAns ("left" and "right" keys). However, I want to add an option to replay the last stimulus when pressing "space" and that it will be also stored, to know how many times people pressed this option in each trial. Any stimulus, then, could be replayed (the idea is that when they are not sure and want to listen to it again they will have this option - to hear the last presented stimulus). How can I do this?
Thank you very much.
martina

PS. I tried to reply to Stack overflow, but there was written: "We are no longer accepting answers from this account"


Dňa pondelok, 16. júna 2014 13:39:38 UTC+12 Michael MacAskill napísal(-a):
Reply all
Reply to author
Forward
0 new messages