Grab value on specific frame only

Hi there,

I’m using the SRTReader and i need to set a value for the duration of each subtitle whenever a new line is displayed.

The Reader has outputs for time elapsed and time remaining which are identical as far as I can tell, so what I need to do as grab the value every time that goes from zero to something, grab that something and set that value so i have the duration of the subtitle in seconds, with that value staying persistent and not changing until a new line of subtitles is displayed.

For context i’m trying to get the time in seconds where a specific word is spoken using the sift node alongside the length of the subtitle later on in my patch, sort of like a karaoke machine that fills up with words as they get sung, but in this case just giving me a rough offset in seconds to apply as a delay to get a bang to happen around the point in time that word is spoken.

Any help would be greatly appreciated!

Elapsed and Remaining do not display the same value, but what the names suggest.
Elapsed shows time since the beginning of the subtitle while Remaining shows time until the end.

To get the total time you could add the two or sample Remaining at the beginning as you have suggested.

Adding the two together will be more precise as the first seen Remaining value will depend on your framestep.

To sample and hold a value, you can use the S+H node. To find out whether a value became non-zero a combination of > and TogEdge can be used.

image

As you can see the length will be held even after the current subtitle is over.

image

The Elapsed + Remaining is more robust as it will work well even when you scrub backwards.

image

SRTReader-FullTime.v4p (9.4 KB)

ah great thanks so much! i’m new here so the sample and hold node is the thing to use in situations like this then

You’re welcome. Indeed.

do you know how to connect multiple bangs to another bang by any chance?

You are probably looking for OR

thanks :)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.