I am having a very frustrating bug: when your audio stimuli have different durations, PsychoPy takes the duration of the first random item in a loop and takes it as “maximum”, cutting short all subsequent files that are longer than that. It seems that this issue has been known for years now (Audio sample cut off + Audio stimuli cut short during trials, etc). Is there really still no solution? I must add that nothing that people have suggested so far works for me: changing the library to Pygame, adding static screen before to let the stimuli to buffer properly, or adding a column $duration which specifies all audio durations. The only solution I have in mind is displaying the longest audio track first and then randomizing the rest, but I don’t know how to code that. Can anyone offer any help?
Ah, okay. I’m having a similar issue, but on a Mac with version 2020.2.4… so it seems that it is bigger than our systems/versions. I’m still trying to get pygame to play nice with me to see if that helps.
Out of curiosity, when you add the duration column, do you then use that variable somewhere?
Well, I tried using it in the duration column in the Audio component ($duration), but it still doesn’t work. I honestly got very frustrated with this bug and wrote entirely custom code which would play my longest item first and then randomize the rest of stimuli. This way no audio gets cut short afterwards. I really hope though that the developers would fix it soon, because this is a crucial feature and I am puzzled why it is still bugged.
Okay, sorry I can’t help you for now! I’ll keep you posted if I find a workaround.
Also linking the other threads that might have similar issues, just in case you missed one:
Thanks, @wakecarter. Unfortunately, it didn’t work to change my library to pygame even for local experiments. Some other libraries change the pitch, others just crash (including pygame). Only sounddevice works for me, but this is the one that cuts audio short. @aisa2 File > Preferences > Hardware > audio library and you can do it there
Thanks; I tried that before and it threw an error, but this time it seems to have worked. Doesn’t solve the problem though. Even with pygame the audio gets cut.
I actually found a solution (it only works on Pavlovia, though, not locally in Python, but that’s what I needed anyway):
you need to use name_of_your_sound_object.stop(); in the End Routine tab (js). Works like a charm!
Okay, so, a really sad update: despite using the stop() function AND having the longest (way longer than the rest) item played first in a sequential order, some items are still randomly cut short prematurely. This is just so frustrating and infuriating. I probably am not gonna use software which cannot perform at a basic level ever again.
I’ve just been looking into this and I can replicate the issue but only in our sounddevice audio engine. I would strongly recommend the PTB backend for the best audio timing.
If anyone finds it’s a problem in the PTB backend then please post a Minimal Working Example of the issue with info about your platform so we can try and debug.
NB the online issue was a separate thing that I believe is also fixed