API / MusicTheory
Swing static class
Swing timing: maps straight score positions to performed positions.
Methods
static double Apply(Rational position, Rational subdivision, double ratio)Maps a straight position to its swung position. Pairs of
subdivision are swung so the first takes ratio of the pair's span (0.5 is straight, 2/3 is triplet swing). On-beat positions do not move.position- The straight position in whole notes, at least 0.
subdivision- The length of each half of a pair, in whole notes.
ratio- The share of the pair taken by its first half, strictly between 0 and 1.
Returns The performed position in whole notes.
Throws ArgumentOutOfRangeException A negative position, a non-positive subdivision, or a ratio outside (0, 1).