I have a task of computing the window number for some time-dependent signals with overlapping. I have broken down the task to a purely mathematical (arithmetic/algebra) problem and provide an illustrative example here to aid thinking.
We are given a fixed window length $l_\text{w}$ in seconds, and an overlap fraction $x$. The windows span t_start to t_finish (t_start is inclusive and t_finish is exclusive), i.e. the interval is $[t_\text{start}, t_\text{finish})$. The question is, given a time $t_k$, what is the general mathematical formula that computes the earliest window $N_k \in \mathbb{N}$ that includes $t_k$? The formula takes two parameters $l_\text{w}$ and $x$.
If that was too abstract, here is a simple example. Consider $l_\text{w} = 0.4 s$. That is the first window $N_1$ spans $[0,0.4)$. The overlap factor is given to be $x=0.4$ which implies an overlap duration of $x\cdot l_\text{w} = 0.16 s$. This means that the next window $N_2$ spans $[0.16,0.56)$ and so on ad infinitum.
The table below can then be visualised (and has no ending point). Now, given any time-point $t_k$, what is the most general formula that predicts the window $N_k$ in which it belongs? eg. if $t_k = 1.40$, the formula should predict $N_k$ = 7. if $t_k = 0.96$ it should predict $N_k=5$ and so on.
| t_start | t_finish | N(window no) |
|:-----------|------------:|:------------:|
| 0 | 0.40 | 1 |
| 0.16 | 0.56 | 2 |
| 0.40 | 0.80 | 3 |
| 0.56 | 0.96 | 4 |
| 0.80 | 1.20 | 5 |
| 0.96 | 1.36 | 6 |
| 1.20 | 1.60 | 7 |
| 1.36 | 1.76 | 8 |
| 1.60 | 2.00 | 9 |
| 1.76 | 2.16 | 10 |
| 2.00 | 2.40 | 11 |
Start by considering only the odd numbered windows. Every time is in one of these and time $t$ is in window $n=2\lfloor \frac t{0.4} \rfloor+1$. Now compute how far you are into the window as $\Delta t=t-0.4n$. If $\Delta t \lt 0.16$ you are in the previous window as well, so subtract $1$.
For the general case, $n=2\lfloor \frac t{l_w} \rfloor+1, \Delta t=t-l_wn$. If $\Delta t \lt xl_w$ you are in the previous window as well, so subtract $1$.