tonal-pitchset
Advanced tools
Comparing version 0.67.0 to 0.68.0
@@ -35,4 +35,7 @@ 'use strict'; | ||
* the rotations that starts with '0' | ||
* @return {Array<String>} an array with all the modes of the chroma | ||
* | ||
* @example | ||
*/ | ||
function rotations (set, normalize) { | ||
function chromaModes (set, normalize) { | ||
normalize = normalize !== false | ||
@@ -81,15 +84,2 @@ var binary = chroma(set).split('') | ||
/** | ||
* Get a pitch set with different tonic | ||
* @param {String|Pitch} tonic - the desired tonic | ||
* @param {Array|String} set - the list of notes or the binary representation | ||
* @param {Array} a list of notes or intervals (depending the root) | ||
* @example | ||
* pitchset.withTonic('c d e f g a b', 'D') | ||
*/ | ||
function withTonic (tonic, set) { | ||
if (arguments.length === 1) return function (s) { return withTonic(tonic, s) } | ||
return fromChroma(chroma(set), tonic) | ||
} | ||
var IVLS = '1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M'.split(' ') | ||
@@ -189,6 +179,5 @@ /** | ||
exports.notes = notes; | ||
exports.rotations = rotations; | ||
exports.chromaModes = chromaModes; | ||
exports.isChroma = isChroma; | ||
exports.chroma = chroma; | ||
exports.withTonic = withTonic; | ||
exports.fromChroma = fromChroma; | ||
@@ -195,0 +184,0 @@ exports.equal = equal; |
19
index.js
@@ -40,4 +40,8 @@ /** | ||
* the rotations that starts with '0' | ||
* @return {Array<String>} an array with all the modes of the chroma | ||
* | ||
* @example | ||
* pitchset.chromaModes('C E G') | ||
*/ | ||
export function rotations (set, normalize) { | ||
export function chromaModes (set, normalize) { | ||
normalize = normalize !== false | ||
@@ -86,15 +90,2 @@ var binary = chroma(set).split('') | ||
/** | ||
* Get a pitch set with different tonic | ||
* @param {String|Pitch} tonic - the desired tonic | ||
* @param {Array|String} set - the list of notes or the binary representation | ||
* @param {Array} a list of notes or intervals (depending the root) | ||
* @example | ||
* pitchset.withTonic('c d e f g a b', 'D') | ||
*/ | ||
export function withTonic (tonic, set) { | ||
if (arguments.length === 1) return function (s) { return withTonic(tonic, s) } | ||
return fromChroma(chroma(set), tonic) | ||
} | ||
var IVLS = '1P 2m 2M 3m 3M 4P 5d 5P 6m 6M 7m 7M'.split(' ') | ||
@@ -101,0 +92,0 @@ /** |
{ | ||
"name": "tonal-pitchset", | ||
"version": "0.67.0", | ||
"version": "0.68.0", | ||
"description": "Pitch set utilities", | ||
@@ -17,5 +17,6 @@ "keywords": [], | ||
"tonal-pitch": "^0.66.0", | ||
"tonal-note": "^0.66.0", | ||
"tonal-transpose": "^0.66.0", | ||
"tonal-array": "^0.66.0" | ||
"tonal-array": "^0.68.0" | ||
} | ||
} |
@@ -29,4 +29,5 @@ var test = require('tape') | ||
// TODO: fixme, the 4th mode should have F# instead of Gb | ||
t.deepEqual(pitchset.rotations('c d e f g a b').map(pitchset.withTonic('C')), | ||
[ [ 'C', 'D', 'E', 'F', 'G', 'A', 'B' ], | ||
t.deepEqual(pitchset.chromaModes('c d e f g a b').map(function (chroma, i) { | ||
return pitchset.fromChroma(chroma, 'C') | ||
}), [ [ 'C', 'D', 'E', 'F', 'G', 'A', 'B' ], | ||
[ 'C', 'D', 'Eb', 'F', 'G', 'A', 'Bb' ], | ||
@@ -81,12 +82,12 @@ [ 'C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb' ], | ||
test('pitchset: rotations', function (t) { | ||
t.deepEqual(pitchset.rotations('c d e f g a b'), | ||
test('pitchset: chromaModes', function (t) { | ||
t.deepEqual(pitchset.chromaModes('c d e f g a b'), | ||
[ '101011010101', '101101010110', '110101011010', '101010110101', | ||
'101011010110', '101101011010', '110101101010' ]) | ||
t.deepEqual(pitchset.rotations('c d e f g a b', false), | ||
t.deepEqual(pitchset.chromaModes('c d e f g a b', false), | ||
[ '101011010101', '010110101011', '101101010110', '011010101101', | ||
'110101011010', '101010110101', '010101101011', '101011010110', | ||
'010110101101', '101101011010', '011010110101', '110101101010' ]) | ||
t.deepEqual(pitchset.rotations('blah bleh'), []) | ||
t.deepEqual(pitchset.chromaModes('blah bleh'), []) | ||
t.end() | ||
}) |
15788
4
415
+ Addedtonal-note@^0.66.0
+ Addedtonal-array@0.68.0(transitive)
+ Addedtonal-freq@0.61.0(transitive)
+ Addedtonal-midi@0.61.0(transitive)
+ Addedtonal-note@0.66.0(transitive)
- Removedtonal-array@0.66.0(transitive)
Updatedtonal-array@^0.68.0