psychopy.org | Reference | Downloads | Github

Sound status not iterating with loop?

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

OS Win10
PsychoPy version v2020.1.3
**Standard Standalone? ** I think so - installed as app on local machine

Hi I’m new to psychopy (coming from Matlab with psychtoolbox) and am trying to design an experiment that plays a different sound file on each trial (specified in a Conditions file - no problem there). Once the sound file is finished, it should play a short ding (loaded as a separate file - also fine). This works ok for the first trial, but the timing of the ding does not seem to update properly in subsequent trials, instead it always occurs after the duration of the sound file from the first trial. This would be ok if all my stimuli were the same duration, but they’re not.

I tried lots of messing around with both sound events in the builder, digging around in the code, lots of googling, but I couldn’t find any other reports of this problem. The ding sound event start is set to “condition” (specifically, sound_1.status == FINISHED). I also tried setting the ding sound event start to the time (instead of condition) of sound_1.getDuration() but the same behaviour emerges. The correct sound files are loading, so the loop is getting the right file info, but I just can’t figure out why the timing of the event isn’t updating accordingly. I suppose I could just manually tack the ding sound onto the end of each sound file, but surely there’s a better solution. Can anyone point me in the right direction? I’m happy to post code if that would help.

Ok I can verify that this is a BUG in psychopy. If I insert the following code at the end of the loop (after the sound has played), then the issue disappears. Apparently the loop will not update the sound event information unless you slap - I mean reset - it manually. Hopefully this will help someone else in the same situation, or get the bug fixed.

sound_1 = sound.Sound(‘A’, secs=-1, stereo=False, hamming=True, name=‘sound_1’)