psychopy.org | Reference | Downloads | Github

Serious timing and sound issues with v3.1.0

#1

OS (e.g. Win10): Mac OS Mojave 10.14.4
PsychoPy version (e.g. 1.84.x): 3.1.0 and 3.1.1 on recent iMacs and MacBook Pro
Standard Standalone? (y/n) Standard Standalone:
**What are you trying to achieve?:**3.1 seriously broke a simple experiment that runs fine in 3.0.7

I would strongly advise anyone running experiments with PsychoPy NOT to install PsychoPy 3.1. (Yes I know not to change versions in the middle of an experiment; and I didn’t!). Versions 3.1.0 and 3.1.1 have broken four things that I have identified in our perfectly-running (under 3.0.7) Builder script:

  1. Playing even a simple sound (like the default A) does not work. It stutters, and is completely not a sine wave! I’ve not tried it with a file but even a simple builder script with only a sound object with the default settings does not work.
  2. The timing is way screwed up. Our keyboard object now sometimes gives negative reaction times! Impossible because the keyboard is not activated until the onset of the stimulus.
  3. The system cursor stays on through all the routines and thus interferes with the stimuli in the main part of the experiment. The “show mouse” box is not selected in the experiment settings!
  4. The onset and duration of the main stimulus (which is specified in frames) seems variable from trial to trial, although I have not spent time investigating.
    I reinstalled 3.0.7 on my MacBook Pro and the script runs perfectly. I have now switched back and forth between the two versions using the same Builder script with always the same results:
    It runs fine under 3.0.7 and shows all these disqualifying problems under 3.1.
    We are lucky that we did not upgrade the computer in the lab that is actually running the experiment!

I did create a new builder script under 3.1 with only a 1 sec sound (the default A) object in the trial. It does not work on my MacBook Pro, my office iMac and 3 other Macs I tested. The exact same script runs jus fine under version 3.0.7. Same symptoms: not a sine-wave tone, but a stuttering sound as if it’s continually restarting the sine wave A (maybe every frame). The duration also is not close to the 1 second value specified.

#2

I’ve been working with Lew Harvey, the poster of this topic, to try to diagnose it. The sound problem appears to have something to do with using the new psychtoolbox keyboard class to detect escape keys for quitting the run.

If you uncheck the “Enable Escape Key” setting in the experiment settings, the sound problem goes away.

Jon Roberts

#3

I think PsychHID starts up a native thread and sets it to a high priority for doing the event processing. Maybe the audio library also starts a native thread, but at a standard / normal priority so it is getting blocked too frequently by the PsychHID thread. Total guess.

I did not realize the PsychHID keyboard implementation was now also the default used by psychopy3.

Is there a way to tell PsychoPy3 to not use PsychHID for the keyboard? I’m worried there may also be some interaction when someone wants to use iohub. From the sounds of it an experiment using iohub will now have psychopy process + iohub process + each potentially also running PsychHID native thread if that is now also started by default. That would probably not be good.

#4

Hi there,

It is true that versions introducing new features (ie. the x.x.0 releases) often have teething problems. We’ll get them fixed as fast as we can.

  1. Stuttering sounds: Haven’t seen this. Will investigate. What sound lib are you using in the PsychoPy preferences? Does changing it (e.g. between sounddevice and pyo) have any impact?
  2. Keyboard sometimes reports negative times: This one we do know about and it’s fixed int he repository. the new keyboard was failing to discard early responses, but was resetting the clock, so that these show up as negative response times.
  3. Mouse cursor: Haven’t seen this and don’t think we’ve changed anything recently. Will investigate
  4. Stimulus timing: let us know if you get any more info on this. How are you detecting the timing errors?

@sol Not yet, and I’m hoping not to do this because I think the timing superiority of the new Keyboard is so important that this should be the only method. Yes, I think the psychtoolbox code probably is creating a new process and if that turns out to be causing issue then we’ll need to fix it, but I’d rather fix it than disable it.

#5

update:

  1. Sound/keyboard interaction: Don’t worry about the sound preference question. I’ve tracked down the problem. The issue is not the presence of the keyboard per se, but the code to check for ‘q’ was accidentally reinitialising the keyboard on every frame (therefore creating lots of processes and lots of lag). Thanks Jon for the tip to look there!
  2. Keyboard timing: fixed
  3. Mouse cursor: As far as I can tell this isn’t actually new. If I set the experiment not to run fullscreen in any recent version I get the mouse showing up, and if I set it to be fullscreen in any recent version the mouse is hidden. I don’t like this behavior and will fix, but it looks like it has been this way for non-fullscreen experiments for many years!
  4. This could well be related to 1. if creating a new process for keyboard handling on every screen refresh then I can imagine frames were being dropped and then the stimulus would overshoot.

In short, I think we can have all these fixed and I’ll aim for a new release tomorrow! :slight_smile:

1 Like
#6

Dear Jon,
Wonderful news. Thank you for the fast response. Jon (Roberts) on our end had found one of your comments on another thread about the negative reaction times so that gave me confidence that you would have a fix soon. Thanks for all you do and keep up the good work.
Lew Harvey

1 Like
#7

I have been facing the same sound issue just after the install itunes on windows 7 when I was playing any song in the application so please help me to fix the problem. I have even check the driver and it was working just fine.

#8

To confirm, the new release 3.1.2 is out at http://www.psychopy.org/download.html fixing issues 1, 2, and 4.

I haven’t touched the presence of the mouse cursor for now. I think it should indeed be changed, but I’ll do that for release 3.2.0 as a feature change. For now, if you run in full-screen mode it will get rid of the mouse cursor and if you really need windowed mode you can use a code-component to turn it off as needed.

#9

Dear Jon,

My script now works like a charm with 3.1.2. Thanks again for the rapid fix.

With best wishes,

Lew

1 Like