Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "harmonics", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Tools and utilities for a generic representation of scales, chords, progressions etc. for use in music software, music related web & mobile apps, VST/VCV plugins and Max for Live devices.", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
const scaleMaps = require('../gen/scaleMaps.json'); | ||
const chordMaps = require('../gen/chordMaps.json'); | ||
const sharpToFlat = (root) => { | ||
const o = { | ||
'C#': 'Db', | ||
'D#': 'Eb', | ||
'F#': 'Gb', | ||
'G#': 'Ab', | ||
'A#': 'Bb', | ||
}; | ||
return o[root] ? o[root] : root; | ||
}; | ||
const getChromatic = (root, octave) => { | ||
@@ -47,3 +58,3 @@ const o1 = [ | ||
const rootOctave = rootOctaveScale.slice(0, indexOfFirstSpace); | ||
const root = rootOctave.replace(/\d/g, ''); | ||
const root = sharpToFlat(rootOctave.replace(/\d/g, '')); | ||
const octave = +rootOctave.replace(/\D/g, ''); | ||
@@ -50,0 +61,0 @@ |
@@ -73,2 +73,16 @@ const scalesAndChords = require('./scalesAndChords'); | ||
test('accepts sharps', () => { | ||
expect(scalesAndChords.scale('C#4 major')).toStrictEqual([ | ||
'Db4', | ||
'Eb4', | ||
'F4', | ||
'Gb4', | ||
'Ab4', | ||
'Bb4', | ||
'C5', | ||
]); | ||
expect(scalesAndChords.chord('C#4 M')).toStrictEqual(['Db4', 'F4', 'Ab4']); | ||
}); | ||
test('returns the notes of a chord if available', () => { | ||
@@ -75,0 +89,0 @@ expect(scalesAndChords.chord('C4 M')).toStrictEqual(['C4', 'E4', 'G4']); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24863
484
0