Time_warp clarification

I am playing with the time_warp function in version 3.1 windows. I am playing the the example #1 and the timing information that Pi is reporting in the log is different then what the documentation describes OR I may be misunderstanding the documentation.

Can anyone help clarify my ignorance?

According to the docs, the last play 70 is supposed to be played at time = 1.5 because the sleep 0.5 in the time_warp is honored. However, that note is run at time = 1.0 as you can see from output here:

{run: 107, time: 0.0 }
   synth: beep, {note: 70.0}
{run: 107, time: 1.0 }
   synth: beep, {note: 75.0}
{run: 107, time: 1.0 }
   synth: beep, {note: 70.0}
{run: 107, time: 1.1 }
   synth: beep, {note: 80.0}
{run: 107, time: 1.6 }
   synth: beep, {note: 80.0}

The Docs say "

shift forwards in time
=> plays at time 0

=> plays at time 1

time shifts forward by 0.1 beats
=> plays at 1.1

=> plays at 1.6
time shifts back by 0.1 beats
however, the sleep 0.5 is still accounted for

we now honour the original sleep 1 and the
sleep 0.5 within the time_warp block, but
any time shift delta has been removed
=> plays at 1.5
"

Hi, would it be possible to share the original code?

Ah, yes, ,I see you meant the examples for time_warp - sorry for misunderstanding.

You’re also correct - the examples are wrong! They must refer back to a prototype implementation that had alternative semantics.

To be clear, once the time_warp block has completed, time is reset to the value it was before time_warp started. So any calls to sleep within the block will not affect the time out of it.

Sorry for any confusion. I’ll ensure the docs are fixed for the next release :slight_smile:

1 Like

Thanks for the clarification! After playing with it some more the behavior makes sense and is intuitive.

1 Like