Dear list,
I play a file using sound [readanysf~] which has the function of showing me the approximate time in seconds--unfortunately the numbers at the output are not always the same(but using always the same soundfile).
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?
Attached is a patch+*.wav illustrating the problem.
Thank you. Gerda
#N canvas 0 0 615 439 10; #X obj 220 162 readanysf~; #X obj 285 197 route float length; #X obj 285 300 ==; #X floatatom 345 293 5 0 0 0 - - -; #X obj 285 342 print now; #X floatatom 345 225 5 0 0 0 - - -; #X floatatom 285 255 5 0 0 0 - - -; #X obj 345 249 int; #X obj 285 278 int; #X obj 345 271 - 3; #X obj 300 323 s end; #X obj 440 235 loadbang; #X msg 439 256 18; #X msg 220 134 open /home/gerda/campioni_pd/earth41.wav; #X msg 164 100 start; #X obj 221 221 dac~ 1; #X floatatom 229 370 5 0 0 0 - - -; #X obj 225 288 print; #X connect 0 0 15 0; #X connect 0 2 1 0; #X connect 1 0 6 0; #X connect 1 1 5 0; #X connect 2 0 4 0; #X connect 2 0 10 0; #X connect 2 0 16 0; #X connect 5 0 7 0; #X connect 6 0 8 0; #X connect 6 0 17 0; #X connect 7 0 9 0; #X connect 8 0 2 0; #X connect 9 0 2 1; #X connect 9 0 3 0; #X connect 11 0 12 0; #X connect 12 0 2 1; #X connect 13 0 0 0; #X connect 14 0 0 0;