On Thu, 2019-01-31 at 15:13 +0000, Mario Buoninfante wrote:
What would be the pros and cons in using [timer] instead of [realtime].
Do you expect some salesman's answer? I'm not good in that. Asking for pros and cons sounds like they have similar features where one is "shining" in one area, while the other is more "brilliant" in this regard. I'd say they are different by nature.
I know the latter asks the OS for time, while [timer] deals with logical time. If I got it right, logical time is tied to the sample rate
No.
(and block size)
No.
, so it's basically the 'Pd time'.
Yes.
I think you figured out the most significant differences already. [timer] is always consistent with objects that are able to schedule something for later, like [metro], [delay], [pipe], [delread~], etc.
However, from what I understand it is not tied to sample rate or blocksize, since it measures logical time in milliseconds. Its accuracy is only limited by the 32bit floating point number format. [timer] will give you the same results, regardless of sample rate.
Another question would also be, which one is the most accurate?
Only [timer] is accurate regarding logical time. Assuming, Pd is running without drop-outs, [realtime] and [timer] will give you similar numbers, but only [timer] reflects the accurate times as they have been generated by [delay], [metro] and such. [realtime] will suffer jitter in the range of your delay in your audio settings. Depending on CPU load, [realtime] will lag behind.
However, if you overload your CPU, because your patch is too demanding to be running in realtime, [realtime] will reflect the effective (phyiscal) time that has passed since it was last triggered. Under such circumstance, the measurements taken by [timer] and [realtime] will drift apart more and more and [realtime] will give you larger values than [timer], because [timer] will be consistent with the amount of audio computed and thus will lag behind realtime.
If this question is applicable.
Try this:
[O]
|
[t b b b]
\ | /
\ [pd heavy_task]
\ /
/
/
/
/
[timer ]
|
[0. \
[timer] will give you always 0. [realtime] will show you the exact amount of time it took to calculate [pd heavy_task]
Heavy task could be something like:
[100000( | [until | [2.34354( | [pow 3842.39]
Hope this helps.
Roman