2

I've encountered an odd bug using psychopy recently, where my script does not kill psychopy when it is terminating.

This only happens when I add a sound to my routine and when I make psychopy generate a sound or play a sound from a file. In other words, just loading sound from psychopy does not result in my script being unable to quit. Only when I make a call to a sound as in s=sound.Sound(value="C", secs=0.15), and even if that sound ins't actually played in my routine by s.play()

I've tried googling to see if other people reported this issue but it seems I'm kinda lonely. I've tested it on two Macs specs below:

MacBook Pro runs:

  • OSX Yosemite
  • enthought python 2.7
  • latest psychopy (recently installed with easy_install)
  • pyglet 1.2
  • pyo 0.7.5
  • Intel Iris graphics card/built in

iMac runs:

  • everything similar to above
  • NVIDIA separate graphics card (don't remember model right now)

Here is some example code I am running. Does this quit fine for you? Does anyone have suggestions regarding what might be going on? Let me know if more info is needed about my system etc.

#Display a text together with a sound synced
#to the onset of the visual display
#---------------------------------------------
from psychopy import core, visual,sound
win = visual.Window([800,800], color='gray', allowGUI=False, winType='pyglet', monitor='testMonitor',units='pix')

stim = visual.TextStim(win, text="Hi!")
s=sound.Sound(value="C", secs=0.15)

startText=visual.TextStim(win, text="starting")
startText.draw()
win.flip()
core.wait(1)
for i in xrange(2):

    for frameN in range(70): 
        stim.draw()
        if frameN == 0:      
            win.flip()
            s.play()
        else:
            win.flip()         
    win.flip()
  core.wait(.2)

Thanks :)

Matthew Moisen
  • 16,701
  • 27
  • 128
  • 231
Bastien
  • 362
  • 2
  • 7
  • 21
  • +1 for a reproducible example (but indentation on last line needs a fix: not sure what level it should be at though). Runs fine for me otherwise (Mac OS X 10.10.3, MacBook Air, PsychoPy standalone 1.82.01). Have you tried changing the order of the sound libraries in PsychoPy's preferences? Using `pyo` instead of `pygame` can sometimes fix sound issues. – Michael MacAskill Apr 23 '15 at 21:46
  • Yep I tried that. Pyo is the default. Haven't tried to run in standalone psychopy though since I haven't installed it. Strange... – Bastien Apr 23 '15 at 21:50
  • What if you explicitly call `core.quit()`? – mmagnuski Apr 24 '15 at 12:51
  • I did add that yes. It seems to be a problem with pyo not being able to close. But that's all I was able to make out. – Bastien Apr 26 '15 at 22:26
  • I came upon this post after googling around for the same exact problem, although since this is my first PsychoPy program I didn't know that the issue was with sound. Running your code produces the same problematic behavior -- fails to terminate about half the time (sometimes even crashes!) using 2015 MacBook pro, PsychPy standalone 1.84.2, MacOS Sierra. Would love an update if you've figured it out... – shanusmagnus Nov 02 '16 at 22:17

0 Answers0