[solved] Crashing after one trial when recording audio
Hello,
I've been running into a recurrent error when I try to run an experiment that involves recording audio. Essentially, everything works perfectly for the first trial, but rather than going on to the second trial, the program exits and then crashes.
I've included two screenshots below (clickable thumbnails). The first is of the interface when everything is normal. (This also shows the design of the experiment.) The second screenshot shows what happens after the program exits the one perfect trial, but before it crashes. I do not get error messages when the experiment exits, so I include the "post-error" screenshop in the hopes that the funny way my entire project design disappears from the overview pane might be diagnostic in some way.
The audio is recorded using the in-line script from here: http://forum.cogsci.nl/index.php?p=/discussion/107/solved-recording-speech-response/p1
I changed a few lines to specify the name of my file and the recording location, but I doubt that they are the problem, because the resulting wave file is correctly labeled and stored in the correct location for the first trial. The relevant lines are here:
import os os.chdir("C:/Users/Clara Cohen/Documents/Dropbox/D/ENproduction/testExperiment")
...
CONDITION=self.get('Condition')
LIST=str(self.get('List'))+""
SENTNUM=str(self.get('SentNum'))+""
SUBJECT=str(self.get('subject_nr'))+"_"
POSITION=str(self.get('count_Record_audio')+1)
WAVE_OUTPUT_FILENAME = CONDITION+LIST+SENTNUM+SUBJECT+POSITION+".wav"
However, something about the audio recording script item is responsible, because the experiment runs fine when I take it out.
After the error, when I close the program, I get the following error message:
"The logfile 'C:\Program Files\OpenSesame\opensesame.exe.log' could not be opened:
[Errno 13] Permissoin denied: 'C:\Program Files\OpenSesame\opensesame.exe.log' "
Please let me know if there is any other information you need to help me figure out why the program keeps crashing after the first trial.
Thanks,
Clara
Pre-error:
Post-error:
Comments
Hi Clara,
Thanks for taking the time to describe your problem in sufficient detail. I think there are two things here.
First, if an error occurs that is not caught by OpenSesame (which in general should not happen), it is written to the file opensesame.exe.log. (When running the Windows binary, that is. Under Linux, for example, the same error would appear in the terminal.) Apparently, you do not have write access to the OpenSesame folder, so the error log cannot be created. This is not really a problem, although obviously it's very inconvenient for debugging.
But the real source of your trouble is probably this line:
os.chdir("C:/Users/Clara Cohen/Documents/Dropbox/D/ENproduction/testExperiment")
OpenSesame (under Windows, again) requires that the working directory is the OpenSesame folder, in order to locate its modules. If you change the working directory, OpenSesame will not be able to find itself anymore, and things will go horribly wrong. The solution will be to not use os.chdir, but to specify the full path for the output filename:
WAVE_OUTPUT_FILENAME = "C:/Users/Clara Cohen/Documents/Dropbox/D/ENproduction/testExperiment/"+CONDITION+LIST+SENTNUM+SUBJECT+POSITION+".wav"
Good luck and cheers,
Sebastiaan
Edit: Issue filed
Check out SigmundAI.eu for our OpenSesame AI assistant!
Thank you very much for this response. I still got an error when I tried to run it:
"IOError: [Errno Input overflowed] -9981"
But I think this is unrelated to the script. In case anyone wants to know what ended up working, I gave up using the parallel feature to display the stimulus and record the response at the same time, because I realize that the stimulus display doesn't disappear when the audio recording follows it. (Yes, yes, but I'm new at this!) So I just have a stimulus display for 2 ms, followed by the audio recording script (while the stimulus is still visible on the screen), and everything works perfectly!
Thank you so much for your help, Sebastiaan.