How to use the tonal-pitches.toIvlStr function in tonal-pitches

To help you get started, we’ve selected a few tonal-pitches 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-distances / dist / index.js View on Github external
function interval(a, b) {
  if (arguments.length === 1) return function (b) {
    return distance(a, b);
  };
  var pa = tonalPitches.asPitch(a);
  var pb = tonalPitches.asPitch(b);
  var i = substr(pa, pb);
  // if a and b are in array notation, no conversion back
  return a === pa && b === pb ? i : tonalPitches.toIvlStr(i);
}
github tonaljs / tonal / packages / tonal-distances / lib / index.js View on Github external
export function interval (a, b) {
  if (arguments.length === 1) return (b) => distance(a, b)
  const pa = asPitch(a)
  const pb = asPitch(b)
  const i = substr(pa, pb)
  // if a and b are in array notation, no conversion back
  return a === pa && b === pb ? i : toIvlStr(i)
}