psychopy.org | Reference | Downloads | Github

Failed to open PortAudio audio device

Hello everyone,

I’ve tried to play a sound using examples found on the documentation like this:

import psychtoolbox as ptb
from psychopy import core, prefs
prefs.hardware[‘audioLib’] = [‘ptb’,‘pyo’]
from psychopy import sound

mySound = sound.Sound(‘C:\Users\Alex\bang.wav’)
now = ptb.GetSecs()
mySound.play(when=now)
core.wait(5.0)

But I’m getting an error:

Exception: Failed to open PortAudio audio device due to unsupported combination of audio parameters.

I can use pyo or sounddevice to successfully play the sound, but it says that ptb should be used for speed. Does anyone have a solution for this?