Sounddevice backend issue?

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.)

Ah, re: the stereo error, there’s a temporary fix here: PsychoPy 1.85.0 issues

Thanks for the info Heidi.

For the error that you tracked down a marginally better solution would be to change the line:

self.sounds.remove(thisSound)

to be

self.remove(thisSound)

rather than commenting out the whole thing.

That should avoid the error that you saw, but will still try to remove the (finished) sound from the set of sounds trying to play.

Oh great. Thanks very much!

Sorry just solved it, file is named backend_sounddevice.py.
Very sorry!

Hi,
sorry for bumping up the issue again, but I still encounter the same problem.
Win 10
PsychoPy2_Py3 1.90.2 standalone

To my own embarassment I can’t find the sounddevice_backend.py. Can you help out? Or should this issue already be solved?

Thanks Katrin