I’m trying to make a sound-heavy experiment work with sounddevice
, due to persistent crashing with pyo
in PsychoPy v1.85.2 (segmentation fault, etc., as described here). I’ve gotten a variety of errors but I did manage to get around one of them and wanted to offer my solution here in case anyone else is struggling with this as well…
The issue arises when I am playing multiple sounds in sequence in a single routine (I’m using Builder). A new image occurs in a random position every 1 second, and each time the participant manages to click on an image, they hear a sound (different depending on the image). The first 4 to 10 sounds play OK, and then the experiment continues (images continue to appear randomly) but the sounds stop. Upon quitting the experiment here’s the error:
self.sounds.remove(thisSound)
ValueError: list.remove(x): x not in list
Commenting out the following lines in sounddevice_backend.py
seemed to fix this problem (all the sounds play now):
# if len(dat) < len(toSpk[:, :]):
# self.sounds.remove(thisSound)
# thisSound._EOS()
Please note that I have NO idea what the purpose of that code was but it seemed vaguely non-essential and commenting it out it doesn’t seem to have caused any new issues, at least not yet…
(Note I’m still having OTHER issues with sounddevice
— e.g., sounds are inconsistently scratchy with the error IOError: Unknown stereo type -1
— but this was happening before my fix, and it seems unrelated.)