Functions to parse time signatures
ES6:
import { TimeSignature } from "@tonaljs/tonal";
node:
const { TimeSignature } = require("@tonaljs/tonal");
single module:
import TimeSignature from "@tonaljs/time-signature";
Return a list of most most frequently-used time signatures:
TimeSignature.names();
Get a time signature:
TimeSignature.get("3/4"); // =>
// {
// empty: false,
// name: "3/4",
// upper: 3,
// lower: 4,
// type: "simple",
// additive: []
// };
type
can be simple
, compound
or regular
Additive signatures are accepted:
TimeSignature.get("3+2+3/8"); // =>
// {
// empty: false,
// name: '3+2+3/8',
// type: 'irregular',
// upper: 8,
// lower: 8,
// additive: [ 3, 2, 3 ]
// }
Arrays can be passed as arguments:
TimeSignature.get([3, 4]);
TimeSignature.get(["3", "4"]);
TimeSignature.get(["3+2+3", "8"]);