How to use the music-gamut.rotate 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-scale / lib / modes.js View on Github external
return s.map(function (n, i) {
    return G.rotate(i, s)
  })
}
github tonaljs / tonal / packages / scale-triads / index.js View on Github external
module.exports = function triads (notes, size, grade, tonic) {
  if (arguments.length === 2) return function (g, t) { return triads(notes, size, g, t) }
  var set = pitchSet(notes, false).map(interval)
  var g = roman(grade)
  var index = selectGrade(g, set)
  if (!index) return null
  var scale = gamut.rotate(1, set.map(transpose(inv(set[index]))))
  var grades = scale.reduce(function (g, ivl) {
    var grade = props(ivl)[0]
    g[grade] = ivl
    return g
  }, {})
  return [1, 3, 5, 7].map(function (i) { return grades[i - 1] }).map(transpose(tonic))
}