Hello!
hoping some of the more math-headed can help me out here...
I have a "time remaininng" osc feed coming into Lemur from VDMX that sends (in seconds) the amount of time remaining til the end of a clip. (328.23 for example)
I want to display this in a HH:MM:SS format... Multiple monitor patch displays would be supah fine if needed. (1 for hours /1 for minutes/etc.)
So far by using NumFX on the VDMX side I can get stuff like 12.23 minutes or 767 seconds remaining, but am hoping to get it into that wonderful "human readable" format like 0 hours 8 minutes 32 seconds... or 00:08:32
My math and scripting simply ain't up to it... Help me Spock...
thanks!
jd
Time Remaining display
-
- Regular
- Posts: 315
- Joined: 02 Nov 2013 11:19
Re: Time Remaining display
// 60 seconds = 1 minute; 60 minutes = 1 hr, 3600 seconds = 1 hr.
hrs = floor (remaining / 3600);
mins = floor ((remaining - (hrs * 3600)) / 60);
secs = floor(remaining - (hrs * 3600) - (mins * 60));
so if you had 3822 seconds remaining --
floor (3822 / 3600) = 1
floor ((3822 - (1 * 3600)) / 60) = floor (222 / 60) = 3
floor (3822 - (1 * 3600) - (3 * 60)) = floor(3822 - 3600 - 180) = 42
That's just a quick and dirty approach, there's probably a more efficient way to do all the intermediate calculations.
You can also have fun with the Modulo operator (3822 % 60) = 42 for possibly a faster (maybe less clear) way to get seconds remaining.
hrs = floor (remaining / 3600);
mins = floor ((remaining - (hrs * 3600)) / 60);
secs = floor(remaining - (hrs * 3600) - (mins * 60));
so if you had 3822 seconds remaining --
floor (3822 / 3600) = 1
floor ((3822 - (1 * 3600)) / 60) = floor (222 / 60) = 3
floor (3822 - (1 * 3600) - (3 * 60)) = floor(3822 - 3600 - 180) = 42
That's just a quick and dirty approach, there's probably a more efficient way to do all the intermediate calculations.
You can also have fun with the Modulo operator (3822 % 60) = 42 for possibly a faster (maybe less clear) way to get seconds remaining.
Re: Time Remaining display
Yup modulo comes in handy!
Re: Time Remaining display
here's an example - the "remaining" time is the constant expression "rem".....
- Attachments
-
- timer.jzml
- (3.82 KiB) Downloaded 73 times
Re: Time Remaining display
Genius. Thanks!!
Thanks for the module softcore, I had juusstt gotten things working using oldgearguy's approach.... That helped "get my learn on" better, i will dissect yours next. Keeps me from being lazy and just "using the widget"
this forum rocks!
thanks much mucho!
jd
Thanks for the module softcore, I had juusstt gotten things working using oldgearguy's approach.... That helped "get my learn on" better, i will dissect yours next. Keeps me from being lazy and just "using the widget"
this forum rocks!
thanks much mucho!
jd
Re: Time Remaining display
Its the same logic anyways! I just presented it in "Lemur" format!