Hey everyone, finally updated to the latest PsychoPy library. Excited about the new low latency sound. After upgrading sounds only play once. This is true for PTB, pyo, sounddevice… What’s happening?
Minimal example:
import psychtoolbox as ptb
from psychopy import prefs
print(prefs.general)
prefs.general['audioLib'] = 'PTB'
from psychopy import sound, visual, event
mySound = sound.Sound('A', secs=0.1)
win = visual.Window([300,200],color="black", units='pix')
win.flip()
while True:
if event.getKeys(keyList=['t']):
print('playing sound')
mySound.play()
Did some more digging around. Turns out that the command for setting audioLib that used to work, e.g.,
prefs.general['audioLib'] = ['pyo']
now does not… it needs to be
prefs.hardware['audioLib'] = ['PTB']
So in my example above, the sound was being played via the default sounddevice. When I switch it to PTB, the problem goes away. The problem with the sound only being played once persists, but is limited to sounddevice