psychopy.org | Reference | Downloads | Github

How Do You Play An Audio File?

How do I play an audio file on disk? What formats are supported by psychopy?

Unfortunately, our sound API documentation still seems to be largely broken:

But in essence:

from psychopy import sound

hello = sound.Sound('hello.wav')
hello.play()

.wav seems to be the format that works best for most people.

The output for playing a simple sound (A) using the Builder or the suggested basic code is
self._player = pyglet.media.ManagedSoundPlayer()
AttributeError: ‘module’ object has no attribute ‘ManagedSoundPlayer’
[psychopy version ‘1.2.2’ on Windows 10].

Do you have any update on how to play audio files?
Thank you.