How to use the music-gamut.asNotes 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 danigb / music-scale / degrees.js View on Github external
'use strict'

var gamut = require('music-gamut')
var transpose = gamut.asNotes(gamut.add)

function find (pitchNum, array) {
  for (var i = 0, len = array.length; i < len; i++) {
    if (array[i][0] === pitchNum) return array[i]
  }
  return null
}

/**
 * Get the degrees of a scale
 *
 * The resulting array will contain the notes in the same order as degrees.
 * If a given degree is not present in the scale, the result will contain a
 * null in that position.
 *
 * @name degrees
github danigb / music-scale / scale.js View on Github external
'use strict'

var curry = require('curry')
var gamut = require('music-gamut')
var transpose = gamut.asNotes(gamut.add)

/**
 * Build a scale from a source and a tonic. A scale is an array of notes (or
 * intervals if tonic is null) ordered by frequency
 *
 * A source can be a list of intervals or notes. The tonic must be
 * a pitch (with or without octave) or null to get the scale intervals
 *
 * This function is currified, so you can partially apply the function passing
 * one parameter instead of two (see example)
 *
 * @param {Array} source - the list of intervals or notes
 * @param {String} tonic - the tonic of the scale
 * @return {Array} the list of notes
 *
 * @example