next up previous contents
Next: jMax sequence object creation Up: Data structures Previous: Used structures   Contents

Numeric values calculation

The main problem of score acquisition is that we have to convert ``musical time'' into ``official time'', i.e.:
- A position in [Measure, Beat, Fraction] into a start time in ms;
- A duration in x/y into a duration in ms.

These convertions are related to tempo, and are calculated as following:

\begin{displaymath}duration =\left( \frac{60000}{tempo} * \frac{n}{d} * td \right)\end{displaymath}

With:
$n$ = note duration upper value
$d$ = note duration lower value
$td$ = time signature lower value

Calculation of start time is a bit more complex because of the possible tempo changes. So we have to calculate elapsed time between two tempo changes and record it as offset.

\begin{displaymath}time =\left( \frac{60000}{tempo} * \left( (m1-m2)tn + (b1-b2) + \frac{f1-f2} {96}\right) + offset\right)\end{displaymath}

With:
$m1$ = measure number of note position
$m2$ = measure number of last tempo change
$b1$ = beat number of note position
$b2$ = beat number of last tempo change
$f1$ = beat fraction number of note position
$f2$ = beat fraction number of last tempo change
$tn$ = time signature upper value
$offset$ = time elapsed from the beginning to last tempo change
($offset$ is calculated by the same way)


next up previous contents
Next: jMax sequence object creation Up: Data structures Previous: Used structures   Contents
Mathieu Gilles (Betr. soltau) 2003-08-25