| Reference | Downloads | Github

IndexError, inaccurate sound delivery, or lack of sound - regardless of audio libraries order

Hi all,

I may have come across a series of inter-connected bugs to do with the specification of audio libraries. In the hardware prefs, if the first in the list of audio libraries is:

  • ‘pyo’, then I get the “IndexError: list index out of range” error reported below, that others also reported, although their problem was not followed through to a solution;
  • ‘sounddevice’, then I get inaccurate sound delivery, as described in problem #3 that I reported here a while ago - again, no luck with replies;
  • ‘PTB’, then there is no sound coming through the speakers when the stimuli are played back in the experiment

The list of preferences for the audio drivers on the other hand appear in my testing to make no difference.

I have an on-board Realtek soundcard (Lenovo laptop) that otherwise works fine. With the exception of the second point above, I’ve not had these problems in the previous (pre 2020) versions of psychopy, thus I imagine this is related to the changes in the recent 2020.1.3 version. Restarting PsychoPy/Windows, and even reinstalling PsychoPy, appears to not help with this.

Would anyone be able to help? Many thanks in advance!

The error message in full:

Traceback (most recent call last):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\", line 770, in showPrefs
    from import PreferencesDlg
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\", line 21, in <module>
    from psychopy import sound
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\", line 157, in <module>
    elif dev not in backend.getDevices(kind='output'):
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\", line 135, in getDevices
    inputs, outputs = get_devices_infos()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\", line 93, in get_devices_infos
    devices = _query_devices()
  File "C:\Program Files\PsychoPy3\lib\site-packages\psychopy\sound\", line 86, in _query_devices
    info[v.strip().split(": ")[0]] = v.strip().split(": ")[1]
IndexError: list index out of range
29.8546     INFO     sound is using audioLib: pyo
29.8547     WARNING     We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use ['pyo', 'pygame', 'sounddevice'] (in that order).

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 2020.1.3

What about pygame?

With pygame as the first option, sound is heard, although I haven’t yet tested whether the sound delivery is accurately recorded (point 2 in my list).

However, what also happens (this might just be a general bug of v2020.1.3) is that after ending the expt, the output screen keeps endlessly flashing the error message screenshoted below, which I cannot copy in text mode as the output window keeps pulsating and is unresponsive.

13-07-2020 14.29.07

File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\runner\”, line 118, in whileRunningFile
returnVal = self.scriptProcess.poll()
AttributeError: ‘NoneType’ object has no attribute ‘poll’

Also, with ‘PTB’ as the first option, I think that actually the sound was coming out through the unexpected channel (HDMI-connected monitor) rather than not at all.

Persistence is the key to obtain suggestions to psychoPy problems, so here I am persisting… :wink:

Any more suggestions to this ongoing problem? Thanks in advance.

I’ve also experienced the pulsating runner output which I think was related to an audio library choice. However, since I’m currently focusing on online experiments where audio library is ignored then I’ve just tried to avoid the issue.