Stream of video images is not controlled

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10):
PsychoPy version (e.g. 1.84.x): 04
Standard Standalone? (y/n) If not then what?: yes
**What are you trying to achieve?:
I have a sound file, 22050Hz, 16 bit, about 22 minutes in duration. I play the sound file, and while the sound is being played, the syllables are shown on the screen (4500 syllables in total, shown sequentially, taken from the excel file). Each syllable should stay on the screen 290 ms.

What specifically went wrong when you tried that?:
No errors are generated. The problem: from time to time the syllables are speeded up, and instead of being on the screen for 290ms a random syllable may only blink on the screen, and the next syllable is played. Or a random syllable stays on the screen longer than 290 ms. It happens approximately once in every 20-30 syllables. Interestingly, the overall duration of the syllable stream is 4500syl * 290ms = 1305sec (as it is supposed to be) and matches the duration of the sound file, that is, I think, speeded up or slowed presentations are compensated from durations of the neighbourng syllables? Presentation of the syllables start and finish with the sound file.

What is to be done to prevent the presentation of a random syllable on the screen from speeding up/staying longer than the defined duration of 290ms?

Could you give some more details of how you play the sound and show the syllables? Screenshots of your routine and flow panel might be particularly useful also.

Hi, Michael.

The long sound is split into 63 shorter audio files. I use the code component to list the sound files I want to play in the BEGIN EXPERIMENT tab:

audio1 = sound.Sound()
audio2 = sound.Sound()
audio3 = sound.Sound()
etc.
In total, I have 63 audios, each audio is equal (except for the last one, which is shorter)

Then I use 63 routines (please see screenshot). Each routine has a code component, with a piece of codes in the BEGIN ROUTINE tab:

if trials2.thisN == 0:
audio2.setSound(“part_stream/2_r.wav”)
audio2.play()
(of course, index is different four each routine, that is, in routine 3 we have “if trial3.thisN == 0:” and so on)

The text component is used to refer to the syllable that has to be shown in the middle of the screen
ISI length is set to 290ms, and in the field of custom code of the ISI we write:
audio2.play()

The loop properties are used to link to the xlsx file that contains a variable syll, just one column, listing the sylalbles, each to be displayed on screen for 290 ms, sequentially

ISIpropertiesloop

In principle, it works, but the presentation of syllable is not happening at equal pace. From time to time a syllable is displayed for a very brief duration, and then the visual stream catches up. This happend approximately every 30 syllables.

OK, the major problem here is the massive amount of duplication. You should only have a single learning routine and single trials loop (in fact, I’m not sure why you even have a loop around each of these individual routines at the moment).

You could potentially play the single sound file for the entire duration of the experiment but test that the display of individual syllables remained in sync with it, alternatively split the sound file up into chunks as you are doing. But at the moment, you don’t get much benefit from pre-creating the sound stimuli at the beginning of the experiment, as you don’t actually specify the sound file until the experiment is running (and this can take time to access from disk). There is a trade off between pre-specifying them all at the start of the experiment (including actually linking to the sound file), which will save time problems later, and the fact that this will consume quite a bit of memory. Hard to know until you test it.

But start off by restructuring your experiment. Save a copy, and delete all but one learning routine and one loop, and link to a single csv file.

Hi, Michael

thanks for attention to my issue.

Yes, my first attempt was to have a long sound file, long excel file, and a single routine. I had the same problem. I thought, maybe, a series of shorter audio files will work better, and made this version that is posted. Same problem. Even if I leave one single routine with a short sound file (i.e., delete the other 62 routines and leave just one), the issue persists…

Try looking at this thread: