[PD] readanysf~ control output of seconds played
Claude Heiland-Allen
claudiusmaximus at goto10.org
Mon Apr 3 16:01:12 CEST 2006
Hi,
Gerda Strobl wrote:
> Dear list,
>
> I need to send a 1-message 3 seconds before the file stops--so I compare
> the actual time with the overall time of the (soundfile -3)---the
> problem is now that sometimes the [==] message never sends a 1 because
> the left input sometimes reaches now value that equals (filelength-3).
>
> print: 14.7215
> print: 16.1844
> print: 17.6472
>
> soundfilelength=18.49
> int(soundfilelength-3)=15
>
> when the output of the seconds of readanysf~ is like above--it doesn't
> equal 15
>
> How can I quickly solve that?
I would get a single bang from the (variable) play time and the (fixed)
total time using [>=], [change], and [select 1]. The important thing is
the ">=", because float "==" is inherently inaccurate, due to rounding
errors and other limitations of floating point numbers. ">=" is useable
as a trigger source when you know that the variable is steadily
increasing.
Claude
--
http://claudiusmaximus.goto10.org
More information about the Pd-list
mailing list