note-duration
Parse note durations. It can convert from name to value and viceversa.
Usage
Install the node module: npm install --save node-duration
and require it from you file:
var duration = ;
You can convert from names to values:
; // => 4; // => 2; // => 1; // => 1/2; // => 1/4; // => 1/8; // => 1/16; // => 1/32
From letter and dots to values:
; // => 1/2; // => dot: 1/2 + 1/4; // => double dot: 1/2 + 1/4 + 1/8; // => triplet: (1/2 + 1/ 2) / 3; // => 1/4; // => dot: 1/4 + 1/8; // => double dot: 1/4 + 1/8 + 1/16; // => triplet: (1/4 + 1/4) / 3
From number string to value:
; // => 1/2; // => dot: 1/2 + 1/4; // => triplet: (1/2 + 1/ 2) / 3; // => double dot: 1/2 + 1/4 + 1/8; // => 1/4; // => dot: 1/4 + 1/8; // => double dot: 1/4 + 1/8 + 1/16; // => triplet: (1/4 + 1/4) / 3
The duration.toString
method does the opposite: convert from value to letter and dots:
duration; // => "h."duration; // => "q.."
License
MIT License