Sound file ends but experiment stalls

If this template helps then use it. If not then just delete and start from scratch.

OS - Win10:
PsychoPy version - 1.84.x:
**Standard Standalone - y
**What are you trying to achieve?: I am trying to avoid adding code, so that I can easily translate the code to use online (Pavlovia). I have a routine with a yes/no decision that must be made after viewing a stimulus. A yes response results in one sound, and a no response in a different sound. I have a key response object and I’ve added two sounds conditional on a yes or no response. The code worked fine when I had only one sound conditional on one response. However, as soon as I added the second sound, the sound will play and the routine ends but it does not loop. It simply stalls.

**What did you try to make it work?: I tried creating two keyresponse objects, but that did not work.

Any help is appreciated.

Personally I would have a single keyboard response and a single audio component in the following routine with the sound file set each repeat. You could add code in End Routine of the first routine to set the name of the audio file and you will probably need to add the two files as additional resources under Experiment Settings / Online

That makes sense, but I’m concerned about whether that code will translate to Pavlovia. I have a version of the program where I added code to terminate the routine after a certain amount of time. That solved the problem, but again, I’m not sure it will translate to JS. I also thought about saving the response (correct or incorrect) to a file and then using that response to determine the sound file. I haven’t use Pavlovia before, but everything I’ve read says to keep it simple and it is not intended to translate code. The builder version works with one sound, so I’m not sure why two sounds is breaking the experiment flow. Thanks though, it gives me another option.

The right kind of code translates well as of January 2020 but I’d recommend that you look at my crib sheet.

I try to code for offline and online and use code in all my experiments.