I need to get PYO to work on a Windows 7 Enterprise Dell Optiplex 7040. It’s a requirement as colleagues are also using PYO on existing equipment, and sound playback (in our detection experiment) is much quieter using PyGame/sounddevice.
I tried first of all with the standalone PsychoPy install. Error:
Portaudio uses interleaved callback. portaudio error in Pa_OpenStream: Illegal combination of I/O devices portaudio error in Pa_CloseStream (pa_deinit): PortAudio not initialized portaudio error in Pa_Terminate (pa_deinit): PortAudio not initialized Portmidi initialized. Portmidi number of devices: 2. Midi input device : -1. Can't get midi input device info : -1. Midi output device : 0. Midi output (Microsoft MIDI Mapper) opened. Portaudio uses interleaved callback.
I then installed the latest PYO (pyo_0.8.7_py2.7_setup.exe) and 32-bit Anaconda for Python 2.7. The rest of this post uses this Python interpreter.
Same errors with this interpreter and latest PYO.
I then got a minimal example working without PsychoPy:
import sys sys.path.append('C:\pyo\Python27\Lib\site-packages') from pyo import * s=Server(sr=44100, nchnls=2, buffersize=256, duplex=1, audio='portaudio', jackname='pyo', ichnls=None, winhost='asio') s.boot() print 'B' s.start() a = Sine(mul=0.01).out() import time time.sleep(5) print 'C'
This crashed until I set winhost=‘asio’, at which point the sound played fine.
I then went into sound/backend_pyo.py in the PsychoPy code and updated the calls which instantiate Server to add this parameter.
PYO then worked fine for about half an hour - I was able to run the following sample code:
import sys sys.path.append('C:\pyo\Python27\Lib\site-packages') from psychopy import prefs prefs.general['audioLib'] = ['pyo'] from psychopy import locale_setup, core, data, event, logging, sound, gui print sound.__file__ f = sound.Sound('1025Hz pure sine_100ms.wav', secs=0.15) f.play() import time time.sleep(5)
…without a problem.
Frustratingly, things have now stopped working again - without me making any changes!
The above sample code runs without error, but hangs without playback, and doesn’t exit.
I will be coming back to this tomorrow. Does anyone have any advice on debugging PYO or finding the problem? I have already set PYO’s verbosity level to DEBUG.