Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var relative = function relative(rel, key) {
var r = asKey(rel);
if (hasTonic(r)) return null;
var k = asKey(key);
if (!hasTonic(k)) return null;
var i = tonalPitches.ivlPitch(modeNum(r) - modeNum(k), 0);
var tonic = tonalDistances.transpose(k.tonic, i);
return build(tonic, rel);
};
var major = function major(n) {
return build(tonalDistances.transpose('C', nP5(n)), 'major');
};
function enharmonics(pitch) {
var enharmonics = [];
enharmonics.push(tonalDistances.transpose(DESC, pitch));
if (enharmonics[0] === null) return null;
enharmonics.push(pitch);
enharmonics.push(tonalDistances.transpose(ASC, pitch));
return enharmonics;
}
function enharmonics(pitch) {
var enharmonics = [];
enharmonics.push(tonalDistances.transpose(DESC, pitch));
if (enharmonics[0] === null) return null;
enharmonics.push(pitch);
enharmonics.push(tonalDistances.transpose(ASC, pitch));
return enharmonics;
}
return tonalArrays.asArr(chords).map(function (e) {
var r = parseRomanChord(e);
return r ? tonalDistances.transpose(r.root, tonic) + r.name : null;
});
}
export const relative = (rel, key) => {
const r = asKey(rel)
if (hasTonic(r)) return null
const k = asKey(key)
if (!hasTonic(k)) return null
const i = ivlPitch(modeNum(r) - modeNum(k), 0)
const tonic = transpose(k.tonic, i)
return build(tonic, rel)
}
return asArr(chords).map((e) => {
const r = parseRomanChord(e)
return r ? transpose(r.root, tonic) + r.name : null
})
}
export function enharmonics (pitch) {
var enharmonics = []
enharmonics.push(transpose(DESC, pitch))
if (enharmonics[0] === null) return null
enharmonics.push(pitch)
enharmonics.push(transpose(ASC, pitch))
return enharmonics
}
var alteredNotes = function alteredNotes(key) {
var alt = alteration(key);
return alt === null ? null : alt < 0 ? tonalRanges.midiRange(-1, alt).map(tonalDistances.fifthsFrom('F')) : tonalRanges.midiRange(1, alt).map(tonalDistances.fifthsFrom('B'));
};
export const alteredNotes = (key) => {
var alt = alteration(key)
return alt === null ? null
: alt < 0 ? midiRange(-1, alt).map(fifthsFrom('F'))
: midiRange(1, alt).map(fifthsFrom('B'))
}