If this template helps then use it. If not then just delete and start from scratch.
OS (e.g. Win10): PsychoPy version (e.g. 1.84.x): Standard Standalone? (y/n) If not then what?: What are you trying to achieve?:
What did you try to make it work?:
What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.
Hi, dear Psychopy community,
I am not a professional Psychopy programmer and tried to write a simple auditory reaction time task using the builder. In one trial of this experiment 4 numbers are going to be shown for 3 seconds and then a sound stimulus will be played with a specific duration. Participants are asked to react to the end of the sound as soon as they can by pressing a button, so there is a keyboard element for recording reaction time. Now my problem is that I could not specify a duration for sound if I want the sound stimuli to be changed in each trial. Therefore my sound element has a start time but does not have an stop time. In order to specify the starting time for the keyboard element I put this as the start point condition (sound_1.status == FINISHED) and this button ends the routine. The problem is that when the sound lasts for example 4 seconds, it seems that the keypress starts before the sound ends! I thought whenever the sound ends its status should turn to FINISHED but it seems that it turns to FINISHED before the actual time. So if my sound should starts and ends for instance at 3 and 7 sec , it seems that key starts from 6.5 or 6 or 6.3. This leads to incorrect reaction time.
How can I specify an exact duration for the sound while it is changing in each trial?
I am really confused! I would be happy if anyone can help.![1|690x388]
I uploaded some pictures, maybe helpful.
Hi,
Thanks Becca, I actually at first did use a variable to control the sound duration ($duration) but I don’t know why when I put $ before the variable name I got an invalid syntax error for that $duration and if I didn’t put $ sign I got a psychopy error. But this time since I was able to run the demo you have sent me, but I wasn’t able to run my experiment with a variable. So I tried to remove the components and bring them again. This time it worked! It is confusing but the important part is that now everything is working fine.
Just a quick question, I have different sound durations and I put exactly the ending point of sound as the starting point of the keyboard. For all of the durations except longer one (12 seconds), the start and stop time of the sound is written at the data file but I don’t know why when the sound is 12 s, the end point in data file is written as None. I thought maybe the keyboard component started a bit earlier than the end of the sound (0.0002 s maybe)? Could be that?
Hi @Becca I am getting the same error using a duration variable as described in this thread. When I enter the variable called ‘MIdur’ as $MIdur into the Duration box of an image component, the experiment won’t run and I get “SyntaxError: invalid syntax.” I’m using v2021.1.4.
Don’t suppose this was ever resolved?
EDIT: I resolved this by removing the $ as described here: Setting Text Duration to Variable Within a Loop
Still not sure why this works fine with a $ in one image component but not in another!