Work with roman numeral representation of degrees
npm install tonal-roman-numeraltonal-roman-numeral is a collection of functions to query about tonal keys.
This is part of tonal music theory library.
Example
``js`
// es6
import * as RomanNumeral from "tonal-roman-numeral"
// es5
const RomanNumeral = require("tonal-roman-numeral")`
Example js`
RomanNumeral.names() // => ["I", "II", "III", "IV", "V", "VI", "VII"]
RomanNumeral.props('ii7') // => { name: 'ii', type: '7', num: 2, major: false }
RomanNumeral.degree(2) // => "II"
RomanNumeral.degree(2, false) // => "ii"
* RomanNumeral
* .props() ⇒ Object
* [.names([isMajor])](#module_RomanNumeral.names) ⇒ .name(name)Array.<String>
* ⇒ .type(name)string
* ⇒ .decimal(name)string
* ⇒ .fromDegree(degree, [isMajor])number
* [](#module_RomanNumeral.fromDegree) ⇒ string
⇒ ObjectKind: static method of RomanNumeral
Returns: Object - - the roman numeral properties
| Type | Description |
| --- | --- |
| string | the roman numeral string (can have type, like: Imaj7) |
Example
`js`
props("VIIb5") // => { name: "VII", type: "b5", num: 7, major: true }
⇒ Array.<String>Kind: static method of RomanNumeral
| Param | Type | Default |
| --- | --- | --- |
| [isMajor] | boolean | true |
Example
`js`
names() // => ["I", "II", "III", "IV", "V", "VI", "VII"]
names(false) // => ["i", "ii", "iii", "iv", "v", "vi", "vii"]
⇒ stringKind: static method of RomanNumeral
| Param | Type |
| --- | --- |
| name | string |
Example
`js`
name('IIb7') // => 'II
name('iii') // => 'iii'
name('Ii') // => null (mixed case not allowed)
⇒ stringKind: static method of RomanNumeral
| Param | Type |
| --- | --- |
| name | string |
Example
`js`
type('Imaj7') // => 'maj7'
⇒ numberKind: static method of RomanNumeral
| Param | Type | Description |
| --- | --- | --- |
| name | string \| number | roman numeral name (with optional type) |
Example
`js`
decimal('IVmaj7') // => 4
decimal(4) // => 4
decimal(10) // => null
⇒ stringKind: static method of RomanNumeral
Returns: string - the roman numeral
| Param | Type | Default |
| --- | --- | --- |
| degree | number | |
| [isMajor] | boolean | true |
Example
`js``
fromDegree(2) // => "II"
fromDegree(2, false) // => "ii"