Closed ylrbc closed 4 years ago
Sorry, this issues list is really for bugs that need fixing in the library. This doesn't look like that so could I'm closing and suggest that you raise it on the forum instead? That said I wonder if the issue is just that you reach a j that's beyond the length of your list?
Hi PsychoJS,
I am trying to manually code an experiment and got some issues with playing sound. I got this problem which I cannot figure out. It would be great if you can let me know what I did wrong and potentially how to fix it. Much appreciated!
Basically I wanted to loop through a few sound files with an interval. The following code snippets of playing sound playing was adapted from the generated code from PsychoPy and put into frame-updating function. "aud_bep" was initialized as an array of sound.Sound, and each of them is set to a file. The status was set to NOT_STARTED before the frame-updating function.
I got an "undefined" error when I try to use for loop:
This is the error message in console:
But the sound files were correctly played if I put everything outside the loop. For example:
Also, if I use "j" to index second object:
only one file will be played. But there is no error message in this case.
It's likely that I did something stupid but I couldn't figure it out for 2 days. If you have some time to take a look, it'd be really awesome. Please let me know if more information is needed.
Thanks! Yu Li