# Durations as variable for the visuals

OS (e.g. Win10):
PsychoPy version (e.g. 1.82.x):
Standard Standalone? (y)
What are you trying to achieve?:
I have simultaneous sound and visual components within each trial in the loop, and I want the visuals have variable onset and durations relative to the sounds. e.g. sound starts at 0, and visual should start at somewhere when the sound is still going on and fade away a little later. The problem is that I don’t have constant values as onset and offset of the visuals.

What is the most efficient way of adding durations as a variable? I don’t see a choice next to start and stop like set every repeat, so should I interpret it as it is not possible to have variable durations?

Best

No, it is certainly possible, but you need to tell us what the constraints are.

e.g. Will the onsets and durations be from a specified list of discrete values, or do they vary within a range? Is there a relationship between the onset and duration, or are they completely independent? Are they randomly generated for each subject, or do you want the same timings for each person? etc…

Please describe as if you were writing a methods section in a paper.

Thank you for the kind response. Good to hear!
I would like to sync the picture to the related word in the audio (the same procedure for each trial, I have 96 trials in the loop, and each trial has a different sound and a picture)
Since I know when the related word starts and ends, I have a list of discrete start and end values for each picture, depending on the word they are paired with.

The order of these 96 sentences is random, and it works fine in randomly playing one of 96 sounds and simultaneously showing the related picture. Would adding two more columns (start and stop) to my conditions file solve the issue? (where I specified which sound to play and which picture to show for each trial)
e.g. xx.wav yy.jpg 2,7 3,4

Hope I could describe it enough.

Yes, that is exactly what you should do. You can simply put the variable names for those columns in the appropriate fields in your experiment (with a `\$` prefix, and set to update on very routine).

1 Like