PTB cuts soundfiles compared to PYO

OS (e.g. Win10): Windows 10 Enterprise
PsychoPy version (e.g. 1.84.x): 2021.2.0
Standard Standalone? (y/n) If not then what?: yes
What are you trying to achieve?:

In the experiment we are presenting parts of songs for 70s. Till now we used the PTB sound library and a preceding ISI to load the sound files as this was recommended by many posts. Yet, yesterday we realized that the songs are no longer presented for ~69,83s but now for roughly 64,34. And this shortened 64s presentation time occurs consistent for different sound files as well as different laptops!!

What did you try to make it work?:

We tried different laptops as well as different sound files. In the sound_component window in builder we tried i, it without putting 70s as a duration anywhere ii, putting it into ‘expected duration’ iii, putting it into the ‘normal’ stop duration window.

Nothing worked. Then we changed to the pyo library and now every sound file is again presented for 69,83s. To us it is not clear why PTB does this and when exactly it stoppedworking since we have older runs in which the duration was always right.

Additionally, we sometimes present the task on a mac (OS Monterey -Psychopy v2021.2.2) and there the pyo library often causes problems (which is known to the community), which is why we still use the ptb library there and strangely there the presentation window of 70 seconds still works!!!

So, we are not sure what causes this and why…

Attached you find our script and the sample music. Maybe we are overlooking something obvious but we would really appreciate the community’s thoughts on this matter since this might influence many of our experiments if this is a legit bug.

A working example can be found here:


on the mac the PTB library is also now somewhat malefunctioning… as you can see from the csv, the first stimulus is played for a shorter duration than the others!

mac_output_example.csv (10.8 KB)

Hi There, as a first suggestion might I ask if this is still an issue in a more recent release?

Best wishes,

Yes, updating to the newest version on Windows did resolve the problem but not for Mac.