How to use the music-gamut.harmonizer function in music-gamut

To help you get started, we’ve selected a few music-gamut 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 / music-chord / lib / type.js View on Github external
module.exports = function (chord) {
  var g = G.harmonizer(chord, false)
  var steps = g.map(function (i) { return i ? i.charAt(0) : i })
  if (steps[0] !== '1' || steps[2] !== '5') return null
  if (g[1] === '3M') {
    if (g[2] === '5A') return 'aug'
    else return g[3] === '7m' ? '7' : 'M'
  } else if (g[1] === '3m') {
    return g[2] === '5P' ? 'm' : 'dim'
  } else if (g[1] === '4P') {
    return 'sus4'
  }
}