Audio stimuli cut short during trials

OS: Win10
PsychoPy version: 3.1
Standard Standalone? (Y)
What are you trying to achieve?:

A transcription task with a free-form text response. Auditory signal manipulations are played prior to transcription, and these are randomized by Block via nested loops.

I have the entire experiment built and running, using both Builder and Code components – though, some audio stimuli are cut short while a condition progresses. This initially seemed random, though it appears now that truncated signals are always the items of relatively longer duration. Further, if one of the longer stimuli is randomly selected as the first item in a block, then only stimuli of longer duration appear to be cut short during the following trials in that block.

Might this be a buffering issue? Can I fix this using the backend? Any ideas on how to avoid auditory stimuli being cut short would be much appreciated!

Many thanks,

Ryan

As potential solutions, I have 1) Left the duration field within the sound object blank (believing that would allow each signal to run its course), 2) Extracted the duration of each item, included it within the spreadsheet as a variable: $Duration, and input that variable name into the duration field within the sound object, and 3) Specified the total duration within the sound object using a specific estimate that I know to be longer than any of the signals: 5.0 sec.

Signals are still being cut short. Any ideas?

Thanks!

It seems that Psychopy imposes a maximum duration on all auditory stimuli within a condition/loop based on the first item read in from a list. As a hack, I’ve managed to get around this by creating stimuli-lists with one silent item (of longer duration than my longest stimulus) that is always played first in each condition. I’ve written code to then randomize the presentation order of all stimuli that follow the silent item.

Not ideal, but it works – and my stimuli are no longer chopped off prematurely.

1 Like

I’m currently adding a much better audio backend (using the audio engine from Psychophysics Toolbox ported to Python). I’ll look at this carefully as part of that work, and might get you to test it out too :slight_smile:

Hi :slight_smile: has this issue been resolved?.. I’m afraid that I might have encountered the same bug now, with psychopy 3.2.3. running on Macbook air.

Is there a better solution than inserting a long silence before stimulus presentation? Also - would the long silence work for a single loop, or should it be the first stimulus of each loop?
Thanks in advance,
Si

Hi C_Berebi,

I don’t believe this issue has been specifically addressed yet. However, in truth, I can’t say for sure; I was sufficiently frustrated with Psychopy after this experience to have not used it to develop any experiments since. You may want to contact JP directly to ask if it’s been fixed yet.

Though, in answer to your second question, I believe you need to insert the “long silence” file at the beginning of every loop/condition. To the best of my knowledge, the bug results in the duration of the audio file presented first within a loop/condition being set as the max duration for all sounds within that loop/condition. So inserting a silent file with a duration longer than any of the stimuli within that loop/condition forces Psychopy to set a max duration that will not truncate any of your stimuli. I had included the long silence under the guise of a “loading” page, instructing participants to hold tight while the experiment loaded, “which might take a few seconds”.

Unfortunately, I don’t have access to the experiment on this machine, so cannot check any specifics within the code for you. But you can easily confirm whether or not the bug still works in the same way by swapping in some alternative stimuli lists within your experiment. If you only have a few items in each condition, you can play with the length of the long silence and the duration of items included in subsequent lists and conditions while trouble shooting.

I hope that helps,

rp

Thanks, RP, for this detailed answer!
Something I still don’t understand about the buffering page you used: how can it be within a loop and not repeat before every other stimulus? I can imagine putting it right before the loop, but how can it be within it?.. (sorry if it’s super-obvious!)

Anyway, thanks again,
Si

OK, I think I’ve got it! :slight_smile:

After trying a bunch of workarounds, the issue magically resolved when I changes the Experiment Settings --> Audio --> Audio library to Pygame, instead of the default.