# @tonaljs/time-signature

> Musical time signatures

Latest version **4.9.0** (published 2024-07-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tonaljs/time-signature
pnpm add @tonaljs/time-signature
yarn add @tonaljs/time-signature
bun add @tonaljs/time-signature
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.9.0 |
| Published | 2024-07-23 |
| First published | 2020-04-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 18.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | danigb@gmail.com |
| Maintainers | danigb |
| Keywords | time signature, time meter, metre, music, theory |

## Links

- npm: https://www.npmjs.com/package/@tonaljs/time-signature
- npm.io page: https://npm.io/package/@tonaljs/time-signature

## Recent versions

- 4.9.0 (latest) — 2024-07-23
- 4.8.1 — 2024-01-04
- 4.8.0 — 2022-11-29
- 4.7.3 — 2022-11-29
- 4.7.2 — 2022-11-29
- 4.7.1 — 2022-11-29
- 4.7.0 — 2022-11-28
- 4.6.10 — 2022-11-18
- 4.6.2 — 2021-07-12
- 4.5.1 — 2020-11-05
- 4.5.0 — 2020-11-04
- 3.6.3 — 2020-05-04
- 3.6.2 — 2020-04-27
- 3.6.1 — 2020-04-27

## README

# @tonaljs/time-signature ![tonal](https://img.shields.io/badge/@tonaljs-time_signature-yellow.svg?style=flat-square) [![npm version](https://img.shields.io/npm/v/@tonaljs/time-signature.svg?style=flat-square)](https://www.npmjs.com/package/@tonaljs/time-signature)

> Functions to parse time signatures

## Usage

ES6:

```js
import { TimeSignature } from "tonal";
```

node:

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

single module:

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

## API

#### `TimeSignature.names() => string[]`

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

```js
TimeSignature.names();
```

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

Get a time signature:

```js
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:

```js
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

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

Arrays can be passed as arguments:

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

## References

- https://en.wikipedia.org/wiki/Time_signature
- https://en.wikipedia.org/wiki/Metre_(music)

---
_Source: https://npm.io/package/@tonaljs/time-signature · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
