How to use tonal-distances - 10 common examples

To help you get started, we’ve selected a few tonal-distances examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tonaljs / tonal / packages / tonal-keys / dist / index.js View on Github external
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);
};
github tonaljs / tonal / packages / tonal-keys / dist / index.js View on Github external
var major = function major(n) {
  return build(tonalDistances.transpose('C', nP5(n)), 'major');
};
github tonaljs / tonal / packages / tonal-notes / dist / index.js View on Github external
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;
}
github tonaljs / tonal / packages / tonal-notes / dist / index.js View on Github external
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;
}
github tonaljs / tonal / packages / tonal-progressions / dist / index.js View on Github external
return tonalArrays.asArr(chords).map(function (e) {
    var r = parseRomanChord(e);
    return r ? tonalDistances.transpose(r.root, tonic) + r.name : null;
  });
}
github tonaljs / tonal / packages / tonal-keys / lib / index.js View on Github external
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)
}
github tonaljs / tonal / packages / tonal-progressions / lib / index.js View on Github external
return asArr(chords).map((e) => {
    const r = parseRomanChord(e)
    return r ? transpose(r.root, tonic) + r.name : null
  })
}
github tonaljs / tonal / packages / tonal-notes / lib / index.js View on Github external
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
}
github tonaljs / tonal / packages / tonal-keys / dist / index.js View on Github external
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'));
};
github tonaljs / tonal / packages / tonal-keys / lib / index.js View on Github external
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'))
}

tonal-distances

Transpose and find distance between notes

MIT
Latest version published 9 years ago

Package Health Score

64 / 100
Full package analysis