psychopy.org | Reference | Downloads | Github

Can't play .wav sound files with pygame

sound

#1

Hello everyone,

I’m using Psychopy 1.85.3 on Windows 10 (dell xps 9350, realtek audio drivers) and I’m trying to play some simple sound files through the builder. Playing .wav files does not seem to be working with the default pygame library, as the program crashes with the following error:

Traceback (most recent call last):
File “C:\Users\Mahiko\Desktop\test\sound_lastrun.py”, line 67, in
sound_1 = sound.Sound(u’audio-numbers/1.wav’, secs=-1)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\sound\backend_pygame.py”, line 101, in init
self.setSound(value=value, secs=secs, octave=octave)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\sound_base.py”, line 179, in setSound
self._setSndFromFile§
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\sound\backend_pygame.py”, line 184, in _setSndFromFile
raise ValueError(msg % fileName)
ValueError: Sound file audio-numbers/1.wav could not be opened using pygame for sound.

Same thing seems to happen with a .flac file. On the other hand, .ogg and .aiff files seem to work, although for some arcane reason they get distorted so that the pitch sounds higher than what it is.

I tried setting the general preferences to use the ‘pyo’ library instead, as suggested in other posts, and while this seem to fix this issue, it seems to bring a new (possibly minor) one, as after the experiment has run I get this error message in the output:

Exception TypeError: “‘NoneType’ object is not callable” in <bound method Server.del of <pyolib.server.Server object at 0x1634DC10>> ignored

Is there something I’m missing? I had a look on the forums but no one else seems to have this issue.