[PD] counting elapsed samples

zmoelnig at iem.at zmoelnig at iem.at
Sun Feb 6 11:40:38 CET 2005

Zitiere Ian Smith-Heisters <heisters at 0x09.com>:

> Hi all,
> I'm trying to resize an array after doing a tabwrite~ to it, like 
> soundfiler can automatically. This seems to me to be a trivial thing to
> do, but I can't figure out how to get the number of elapsed samples. I
> considered using a [timer], but last time I used that it was extremely
> innaccurate, especially with high system loads.

[timer] gets you the logical(!) time between 2 events in pd.
this is exactly what you want!

i do not think that there is really an inaccuracy, probably the problem lies
somewhere else ?

the only problem i can think of, is when you loose some ticks because of very
high system load (but then you will get clicks and the time lost might be the
smallest problem)

> Would a combination of [realtime] and [samplerate~] be accurate? I guess

realtime measures the elapsed time viewed from the "world outside" (this is
becoming relativistic); since you are not interacting with the world outside
(apart from dac/adc which is ok) [realtime] might not be the way to go.

> I shy away from deducing the number of elapsed samples, as I'd rather 
> get the true number somehow--but this is the only way I can figure it 
> out so far. Any tips?

you will never get below 64 samples in accuracy anyhow (no matter whether you
try with [timer], [realtime], [time] or whatever


More information about the Pd-list mailing list