audiopygamepsychopypyo

Changing preferences from Pyo to Pygame in Psychopy


I am trying to change the preferences of audiolib from Pyo to Pygame in Psychopy but it does not seem to work.

from psychopy import prefs, sound
prefs.general['audioLib'] = ['pygame']
.
.
.
sound1 = sound.Sound('name.wav')
sound1.play()

It keeps showing:

pyo version 0.8.0 (uses single precision)

The sound is alright but I want to use Pygame instead. Can anyone tell me what I am doing wrong? Thanks!


Solution

  • Import sound after changing the preferences.

    # Set preferences first
    from psychopy import prefs
    prefs.general['audioLib'] = ['pygame']
    
    # Now load the psychopy modules that you want, using the preferences above
    from psychopy import sound