| Reference | Downloads | Github

How to correctly use pygame sound engine to play a sound?

I got an error message “AttributeError: module ‘psychopy.sound’ has no attribute ‘backend_pygame’”, when trying to use sound class through the code below.

from psychopy import sound
import pygame
mySound= sound.backend_pygame.SoundPygame(value='C', secs=5, octave=4,sampleRate=44100, bits=16,name='', autoLog=True, loops=0, stereo=True, hamming=False) 

Hi @Spenserark_Bottest, you could always use the PsychoPy sound module instead of the Pygame backend specifically. Take a look at the Coder demos > Stimuli > Also, PsychoPy 3.2 now uses the PsychToolBox audio backend, providing sub-millisecond timing for your audio.

1 Like