psychopy.org | Reference | Downloads | Github

Using sound crashes program in OSX

We are currently programming an eye tracking experiment that uses sound. The behavioral version worked just fine on our laptop, but when we intergrated the eyetracking code, it started crashing on our eyetracking computer (other eye tracking experiment work just fine).

We traced the crash to these two lines:

beep = sound.Sound.("beep.wav")
beep.play()

The sounds plays just fine, but the program crashes later on when we try to link with the Eyelink. If we comments out those two lines of code, the experiment works fine (albeit with no sound).

MacPro OSx 10.7.5
PsychoPy v1.85.2

I don’t know why this would be causing issues, but note that you should only create the sound once (at the start of the experiment code), and then just issues beep.play() as required later. Initialisation of the sound is time-expensive (the sound file needs to be read in from disk each time, and the sound object created from it, tasks that only need to occur once).

We tried nearly every environmental switch under the sun.

Finally, we moved those lines of code so that the were after the eye tracker setup code (those two lines were our way of preloading the beep before the loop that runs through our trials). I don’t know why it works, but that was our solution, and it seems to work (so far).