@tonaljs/time-signature
TypeScript icon, indicating that this package has built-in type declarations

4.8.1 • Public • Published

@tonaljs/time-signature tonal npm version

Functions to parse time signatures

Usage

ES6:

import { TimeSignature } from "tonal";

node:

const { TimeSignature } = require("tonal");

single module:

import TimeSignature from "@tonaljs/time-signature";

API

TimeSignature.names() => string[]

Return a list of most most frequently-used time signatures:

TimeSignature.names();

TimeSignature.get(name: string | [number, number]) // => object

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, regular, irregular or irrational

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 ]
// }

Irrational signatures are also interpreted:

```js
TimeSignature.get("12/10"); // =>
// {
//   empty: false,
//   name: '12/10',
//   type: 'irrational',
//   upper: 12,
//   lower: 10,
//   additive: []
// }

Arrays can be passed as arguments:

TimeSignature.get([3, 4]);
TimeSignature.get(["3", "4"]);
TimeSignature.get(["3+2+3", "8"]);

References

Package Sidebar

Install

npm i @tonaljs/time-signature

Weekly Downloads

525

Version

4.8.1

License

MIT

Unpacked Size

18.9 kB

Total Files

9

Last publish

Collaborators

  • danigb