https://github.com/danigb/interval-notation
Parse and build musical intervals in shorthand notation
https://github.com/danigb/interval-notation
music-theory musical-intervals parse
Last synced: 12 months ago
JSON representation
Parse and build musical intervals in shorthand notation
- Host: GitHub
- URL: https://github.com/danigb/interval-notation
- Owner: danigb
- License: mit
- Created: 2016-04-23T20:02:12.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-05-05T15:55:41.000Z (about 9 years ago)
- Last Synced: 2025-01-27T17:23:42.148Z (over 1 year ago)
- Topics: music-theory, musical-intervals, parse
- Language: JavaScript
- Size: 34.2 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
# interval-notation [](https://www.npmjs.com/package/interval-notation)
[](https://travis-ci.org/danigb/interval-notation) [](https://codeclimate.com/github/danigb/interval-notation)
[](https://github.com/feross/standard)
Parse music intervals in shorthand notation (https://en.wikipedia.org/wiki/Interval_(music)#Shorthand_notation) with javascript. Given a string, obtain an object
with interval properties (including interval size in semitones). It provides function to build string from its properties.
## Install
yarn: `yarn add interval-notation`
npm: `npm i --save interval-notation`
## Usage
ES6 modules:
```js
import { parse, shorthand } from 'interval-notation'
parse('M3') // => { num: 3, q: 'M', dir: 1, simple: 3,
// type: 'M', alt: 0, oct: 0, size: 4 }
shorthand(3, 0, 0, 1) // => 'M3'
```
ES5 node import:
```js
var interval = require('interval-notation')
interval.parse('M3') // => { num: 3, q: 'M', dir: 1, simple: 3,
// type: 'M', alt: 0, oct: 0, size: 4 }
interval.shorthand(3, 0, 0, 1) // => 'M3'
```
## Documentation
You can read the [generated API documentation here](https://github.com/danigb/interval-notation/blob/master/API.md)
## Test and development
To run the test clone this repo and:
```
npm i
npm test
```
## License
MIT License