Hi all,
I´ve been experiencing various problems with playing sound files in PsychoPy (Coder), depending on the system on which the experiment is running and on the PsychoPy version.
The script per se works without any problems but as soon as I include sound files, the experiment crashes (on some machines). I´ve been running my experiments on PsychoPy 1.84.0 so far and on the windows10 machine on which I programmed the current experiment, it works perfectly fine even with sound files included. However, there are times when I have to restart the program several times until it works and - although everything works - the following error message is shown in the output window:
pyo version 0.8.0 (uses single precision)
portaudio error in Pa_OpenStream: Unanticipated host error
Portaudio error: Unanticipated host errorportaudio error in Pa_AbortStream: Invalid stream pointer
portaudio error in Pa_CloseStream: Invalid stream pointer
Server not booted.
The Server must be booted!
When I tried to run the same experiment with another windows machine (win7) but the same PsychoPy version (v1.84.0), the experiment ran a couple of times but suddenly, without changing anything, it crashed as soon as the run button was pressed (producing a windows error message: “pythonw.exe has stopped working”). At other times, only the experiment crashes but not PsychoPy, with the error message “Couldn´t measure a consistent frame rate. Is your graphics card set to sync to vertical blank? Are you running other processes on your computer?” (As recommended here: https://groups.google.com/forum/#!topic/psychopy-users/FYVH1uoU4kE, I tried the coder demo “TimeByFrames.py” - I´ve also attached the results to this post).
On another windows machine (win 10, PsychoPy v1.84.0), the experiment breaks with the error message “Attribute error: No audio API found. Try installing pyo 0.6.8+, or pygame 1.8+”
(in the PsychoPy Preferences, there are pyo and pygame listed in the audio library (in this order, but I´ve already tried out setting pygame before pyo and it doesn´t work either) and all settings are equal to those on which the experiment works.
Lastly, I´ve tried out different other versions of PsychoPy but all of them led to different error messages (see attachments), amongst others (v1.85.6) a unicode decode error which does not make any sense to me, as the script has been working fine for years and I cannot imagine that “encSound” causes a unicode error?
With v1.90.2, the output window says "Attribute Error: OrderedDict obect has no attribute ‘TrialNum’ ". Again, there has never been a problem with a missing TrialNum attribute so far …
So by now, I´m more than confused and would be very grateful if somebody could help me find the one problem that leads to all these different error messages and crashes…
Regarding the sound components within my code, it looks as follows:
from psychopy import locale_setup, visual, core, data, event, logging, sound, gui, parallel
[…]
encSound = sound.Sound()
[…]
for thisEncoding in encoding:
[…]
encComponents.append(encSound)
encSound.setSound(soundpath)
if t >= 1.0 and encSound.status == NOT_STARTED:
encSound.tStart = t
encSound.frameNStart = frameN
encSound.play()
if encSound.status == STARTED and t >= (1.0 + (8.5-win.monitorFramePeriod*0.75)):
encSound.stop()
Thank you for your help in advance!