Hi there,
I’m making an experiment with Psychopy 2022.2.2 and I’ve run into what I would consider unintuitive behaviour from the PTB sound object. This has taken me a good amount of time to investigate and diagnose so I’d like to notify the developers and users about this.
There are two issues with the PTB sound object. The unintuitive issue that I encountered is that the PTBsound.statusDetailed['State']
property appears to update its state to reflect what is scheduled to occur in the upcoming screen refresh. So, if the sound is scheduled to be played half a screen refresh in the future, then statusDetailed['State']
will change from 1
to 2
during the current frame. I expected this state change to only happen after the sound had started playing. This was confusing me when I was trying to log the beginning of a sound as well as the current time for an EEG marker, finding that the beginning of the sound was somehow AFTER the current logged time. Perhaps the timing of the status change should be documented here to be clear about this behaviour?
Now the second related issue. You may be wondering why I went into the statusDetailed['Status']
object to get the sound’s status, instead of using the documented status
property for the PTB Sound class. I had to do this because, in my tests, the status
property is unusable. This property equals 1
when the sound has either not started playing or has already started playing, and then it equals -1
when the sound is scheduled to stop playing. Clearly I could not use this to figure out when the sound started, and these two states are very different from the stated possibilities of NOT_STARTED, STARTED, FINISHED, PAUSED in the documentation. As it stands, this appears to be an unexpected bug in the status
property.
Hopefully this is helpful! I might try to figure out how to contribute to Psychopy docs/code to help fix this, but I thought I’d at least put it on everyone’s radar.