Comparing version 1.0.0-1 to 1.0.0-pre2
@@ -1,8 +0,8 @@ | ||
"use strict"; | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var index = require("tonal-array/index"); | ||
var index$1 = require("tonal-note/index"); | ||
var index$2 = require("tonal-distance/index"); | ||
var tonalArray = require('tonal-array'); | ||
var tonalNote = require('tonal-note'); | ||
var tonalDistance = require('tonal-distance'); | ||
@@ -60,3 +60,3 @@ /** | ||
*/ | ||
const fromAlter = i => index$2.trFifths("C", i) + " major"; | ||
const fromAlter = i => tonalDistance.trFifths("C", i) + " major"; | ||
@@ -87,7 +87,7 @@ const names = (alt = 4) => { | ||
k.modenum = modenum(k.mode); | ||
const cs = index.rotate(k.modenum, NOTES); | ||
k.intervals = cs.map(index$2.interval(cs[0])); | ||
k.scale = k.intervals.map(index$2.transpose(k.tonic)); | ||
k.alteration = index$2.fifths("C", k.tonic) - FIFTHS[MODES.indexOf(k.mode)]; | ||
k.accidentals = index$1.altToAcc(k.alteration); | ||
const cs = tonalArray.rotate(k.modenum, NOTES); | ||
k.intervals = cs.map(tonalDistance.interval(cs[0])); | ||
k.scale = k.intervals.map(tonalDistance.transpose(k.tonic)); | ||
k.alteration = tonalDistance.fifths("C", k.tonic) - FIFTHS[MODES.indexOf(k.mode)]; | ||
k.accidentals = tonalNote.altToAcc(k.alteration); | ||
return Object.freeze(k); | ||
@@ -175,4 +175,4 @@ }; | ||
: alt > 0 | ||
? index.range(1, alt).map(index$2.trFifths("B")) | ||
: index.range(-1, alt).map(index$2.trFifths("F")); | ||
? tonalArray.range(1, alt).map(tonalDistance.trFifths("B")) | ||
: tonalArray.range(-1, alt).map(tonalDistance.trFifths("F")); | ||
}; | ||
@@ -192,3 +192,3 @@ | ||
if (!p.name) return []; | ||
const chords = index.rotate(p.modenum, CHORDS); | ||
const chords = tonalArray.rotate(p.modenum, CHORDS); | ||
return p.scale.map((tonic, i) => tonic + chords[i]); | ||
@@ -210,3 +210,3 @@ }; | ||
if (!p.name) return []; | ||
return p.scale.map(t => index$2.transpose(t, "P5") + "7"); | ||
return p.scale.map(t => tonalDistance.transpose(t, "P5") + "7"); | ||
}; | ||
@@ -236,5 +236,3 @@ | ||
if (k.name === null) return null; | ||
return ( | ||
index$2.trFifths(k.tonic, FIFTHS[num] - FIFTHS[k.modenum]) + " " + mode | ||
); | ||
return tonalDistance.trFifths(k.tonic, FIFTHS[num] - FIFTHS[k.modenum]) + " " + mode; | ||
}; | ||
@@ -252,3 +250,3 @@ | ||
const tokenize$1 = name => { | ||
const p = index$1.tokenize(name); | ||
const p = tonalNote.tokenize(name); | ||
p[3] = p[3].toLowerCase(); | ||
@@ -255,0 +253,0 @@ if (p[0] === "" || MODES.indexOf(p[3]) === -1) return [null, null]; |
@@ -16,5 +16,5 @@ /** | ||
*/ | ||
import { rotate, range } from "tonal-array/index"; | ||
import { tokenize as split, altToAcc } from "tonal-note/index"; | ||
import { trFifths, fifths, interval, transpose } from "tonal-distance/index"; | ||
import { rotate, range } from "tonal-array"; | ||
import { tokenize as split, altToAcc } from "tonal-note"; | ||
import { trFifths, fifths, interval, transpose } from "tonal-distance"; | ||
@@ -21,0 +21,0 @@ const MODES = "major dorian phrygian lydian mixolydian minor locrian ionian aeolian".split( |
{ | ||
"name": "tonal-key", | ||
"version": "1.0.0-1", | ||
"version": "1.0.0-pre2", | ||
"description": "Conversion between key numbers and note names", | ||
@@ -20,5 +20,5 @@ "repository": "https://github.com/danigb/tonal/packages/key", | ||
"dependencies": { | ||
"tonal-array": "^1.0.0-1", | ||
"tonal-distance": "^1.0.0-1", | ||
"tonal-note": "^1.0.0-1" | ||
"tonal-array": "^1.0.0-pre2", | ||
"tonal-distance": "^1.0.0-pre2", | ||
"tonal-note": "^1.0.0-pre2" | ||
}, | ||
@@ -25,0 +25,0 @@ "babel": { |
@@ -24,2 +24,3 @@ <a name="module_key"></a> | ||
* [`.alteration(key)`](#module_key.alteration) ⇒ <code>Integer</code> | ||
* [`.accidentals(key)`](#module_key.accidentals) ⇒ <code>String</code> | ||
* [`.alteredNotes(key)`](#module_key.alteredNotes) ⇒ <code>Array</code> | ||
@@ -130,2 +131,18 @@ * [`.chords(name)`](#module_key.chords) ⇒ <code>Array</code> | ||
``` | ||
<a name="module_key.accidentals"></a> | ||
## `key.accidentals(key)` ⇒ <code>String</code> | ||
Get key accidentals: a string with sharps or flats | ||
**Kind**: static method of [<code>key</code>](#module_key) | ||
| Param | Type | | ||
| --- | --- | | ||
| key | <code>String</code> | | ||
**Example** | ||
```js | ||
import * as key from 'tonal-keys' | ||
key.accidentals('A major') // => "###" | ||
``` | ||
<a name="module_key.alteredNotes"></a> | ||
@@ -132,0 +149,0 @@ |
128758
232
3014
Updatedtonal-array@^1.0.0-pre2
Updatedtonal-distance@^1.0.0-pre2
Updatedtonal-note@^1.0.0-pre2