I would like to build a horizontal bar with a timeline marker for the song.I think I would be able to build a reasonable GUI. But I need some way to calculate the time in seconds at all duration of the song.Some notions that I have thought to do this.
Basically, the song consists of patterns in sequence, from 1 to 1000. Each pattern is formed by a certain number of lines, from 1 to 512.
The minimum of a song is a pattern with a single line. The maximum would be 512 lines x 1000 patterns
The time of song depends on the BPM (beats per minute) and LPB (lines per beat) settings. EDIT: and the parameters ZT ZL!!!
My doubts are to construct a mathematical code that sums the linesof the whole song in each moment to get the real time of the song.Can anyone think of a code that can do that?I think the sum in seconds would be enough. Subsequently, it can be converted to minutes and seconds. If the user includes or deletes a single line (line or pattern (group of lines)), the mathematical code would recalculate the final figure in seconds.
It would be possible to use a timer to detect any line / pattern changes (not to be confused with the time calculation of the song, which is something else).
Any ideas for the mathematical code?
Some API data:
… number_of_lines_in_pattern ???
renoise.song().transport.bpm(beats per minute, a minute = 60 s)
renoise.song().transport.lpb(lines per beat)
Is there any API code to help with all this?