slurmulon / gig

:sound: Bach player for JS
MIT License
1 stars 0 forks source link

Support seek to position #6

Open slurmulon opened 6 years ago

slurmulon commented 6 years ago

We first need to first support translating a time position in a track (e.g. 00:30) into the closest beat and measure cursors.

We then need to calculate the size of the interval at the beat and measure cursors. The size of the interval will be offset by the difference between the standard/default interval and the time remaining until the next interval.

More formally, if C is the timestamp found at the seeked position, E is the scheduled/expected invocation timestamp of the next interval, and R is the amount of time remaining (in ms) until the next interval, then:

R = E - C