# note-duration

> Parse note durations

Latest version **1.3.0** (published 2015-06-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install note-duration
pnpm add note-duration
yarn add note-duration
bun add note-duration
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2015-06-01 |
| First published | 2015-05-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | danigb |
| Maintainers | danigb |
| Keywords | note, duration, time, signature, music, theory, solfege |

## Links

- npm: https://www.npmjs.com/package/note-duration
- Repository: https://github.com/danigb/note-duration
- Issues: https://github.com/danigb/note-duration/issues
- npm.io page: https://npm.io/package/note-duration

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.3.0 (latest) — 2015-06-01
- 1.2.0 — 2015-05-27
- 1.1.1 — 2015-05-22
- 1.1.0 — 2015-05-21
- 1.0.0 — 2015-05-19

## README

# note-duration

[![Code Climate](https://codeclimate.com/github/danigb/note-duration/badges/gpa.svg)](https://codeclimate.com/github/danigb/note-duration)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)


Parse note durations. It can convert from name to
[value](http://en.wikipedia.org/wiki/Note_value) and viceversa.

## Usage

Install the node module: `npm install --save node-duration`
and require it from you file:

```js
var duration = require('note-duration');
```

You can convert from names to values:

```js
duration('long');          // => 4
duration('double');         // => 2
duration('whole');          // => 1
duration('half');           // => 1/2
duration('quarter');        // => 1/4
duration('eighth');         // => 1/8
duration('sixteenth');      // => 1/16
duration('thirty-second');  // => 1/32
```

From letter and dots to values:

```js
duration("h");   // => 1/2
duration("h.");  // => dot: 1/2 + 1/4
duration("h.."); // => double dot: 1/2 + 1/4 + 1/8
duration("ht");  // => triplet: (1/2 + 1/ 2) / 3
duration("q");   // => 1/4
duration("q.");  // => dot: 1/4 + 1/8
duration("q.."); // => double dot: 1/4 + 1/8 + 1/16
duration("qt");  // => triplet: (1/4 + 1/4) / 3
```

From number string to value:

```js
duration("2");   // => 1/2
duration("2.");  // => dot: 1/2 + 1/4
duration("2t");  // => triplet: (1/2 + 1/ 2) / 3
duration("2.."); // => double dot: 1/2 + 1/4 + 1/8
duration("4");   // => 1/4
duration("4.");  // => dot: 1/4 + 1/8
duration("4.."); // => double dot: 1/4 + 1/8 + 1/16
duration("4t");  // => triplet: (1/4 + 1/4) / 3
```


The `duration.toString` method does the opposite: convert from value to letter and dots:

```js
duration.toString(1/2 + 1/4);        // => "h."
duration.toString(1/4 + 1/2 + 1/8);  // => "q.."
```

## License

MIT License

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