I use: OS Windows 7 64-bit, and PsychoPy version 1.84.2 Standalone.
I can run this experiment (grmjudg.psyexp (10.5 KB)) without a problem, but as soon as I introduce sounds(like grmjudg2.psyexp (11.2 KB)), I get a windows error saying “pythonw.exe has stopped working” and the experiment crashes.
I have tried deactivating my firewall and antivirus-softwares, but that didn’t help.
Has anyone run into similar problems and found a solution? Since I definitely need audio in my experiments, this is a big problem for me. Would be great to get some suggestions!
Hello Raina, so is there any other error message? Could you post the full message if so?
If audio is to blame, there’s another additional backend instead of pyo and pygame called pysoundcard. Apparently it’s not quite as well tested and I personally haven’t tried it, but maybe it’s worth a shot. In your preferences, put ‘pysoundcard’ first in the list and try it out?
Dear @daniel.riggs1,
Thank you for your reply!
This is the windows error message (in German) which says that python.exe has stopped working
actually, this time I run the program it is python.exe, and sometimes it is pythonw.exe! Hm…
Then psychopy does not give me an error message. Just this:
When I set pysoundcard in the general settings, then interestingly I dont get a windows error message, but the experiment can also not be run, giving me this error message:
I took a good look at this, and it looks like this is a bug. Hopefully when I get a chance I’ll file an issue for this for the developers, but as @jon has mentioned elsewhere, pysoundcard is not well tested, but it was worth a shot.
So I’ve seen you post elsewhere on the forum about pygame not being included in the distribution of 1.84.2, and this being related to your issue here. Is that the case? In the future it might be good to include that information on this thread.
To see if pygame is installed, open the coder view, then toward the bottom click the “shell” tab. Enter “import pygame” (without the quotes) and hit enter. If nothing happens, then you do have it installed, otherwise it will give a not found error.
So if pygame isn’t installed, one thing to try would be installing it, but I’m not exactly sure how to do that for the standalone version on Windows (we can’t use pip). @jon , any help on this? Hopefully I’ve given sound advice on this.
I think copy pasting from this posting should work.
Also, line 417 (now 418) says “Sound file %s could not be opened using pygame for sound”. Change pygame to pysoundcard.
But again, apparently this library isn’t super well tested. For me it’s now playing sound fine (though I had to fix another bug in a dependency, will post about this to github). It sounds like you have very simple requirements (just play a sound file). Hopefully this will be good enough for you.
Again, make a backup of the file. Add these lines starting at line 112 (copy paste would probably be the best idea here):
typedef enum PaHostApiTypeId
{
paInDevelopment=0, /* use while developing support for a new host API */
paDirectSound=1,
paMME=2,
paASIO=3,
paSoundManager=4,
paCoreAudio=5,
paOSS=7,
paALSA=8,
paAL=9,
paBeOS=10,
paWDMKS=11,
paJACK=12,
paWASAPI=13,
paAudioScienceHPI=14
} PaHostApiTypeId;