Playing tones based on a list of start times (without loop)

Hello!

What I want:
I want to present several tones in one routine without a loop.

What I did:
I opened a sound component. In the Start times a created a variable $Play
I opened a code component:
In ‘Begin Experiment’ I defined a variable: myStartTimes = [1.1, 2.4, 3.7]
In ‘Each Frame’ I created the following code:

for i in myToneTimes:
    Play = i

When I start the experiment then I hear only one tone.

I tried another solution to update the list with the „t“ variable (again ‘Each Frame’ in the code component):

for i in myToneTimes:
    if t in myToneTimes:
        Play = i

When I start the experiment I again hear only one tone.
I don’t know how I can say the program to jump to the next start time after execution of the previous.

Thank you very much for any help!
Best, Mark

I suspect that the start time of a component is set at the begining of a routine, and can’t be changed once the routine has started.

You might find the sound method I use in Check Sounds useful

Dear wakecarter

Thank you very much for the demo! It really helped me a lot to get a deeper insight how Builder can be used.
I tried several things regarding my problem but could not find a solution. So I will generate simply several (hundreds) of tone components with different start times in one routine. Hopefully this is not a problem for PsychoPy.

Best, Mark

That sounds like you’re planning to replace some fairly simple code with several hours of extra work creating unnecessary components. It might be worth sharing where you’ve got to or engaging our consultancy team