How to use music-scale - 10 common examples

To help you get started, we’ve selected a few music-scale 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 / app / scales.js View on Github external
var Scale = require('music-scale/all')
var Chromatic = require('chromatic')

var types = ['one note', 'interval', 'triad', 'cuatriad', 'pentatonic',
'hexatonic', 'heptatonic', 'octatonic', '9 notes', '10 notes', '11 notes', '12 notes']

var NAMES = Scale.Names.names()
var all = [].concat(NAMES)

function isValidPattern (pattern) {
  return pattern &&               // present
    !/^\s*$/.test(pattern) &&     // not empty
    !/^\d$/.test(pattern)         // if number, at least 2 digits
}

function notes (root, binary, len) {
  var x, i
  return Chromatic(root, 4, len).map(function (chroma) {
    var notes = []
    for (x = 0; x < len; x++) {
      i = x % 12
      if (binary[i] === '1') notes.push(chroma[x])
    }
github danigb / music-scale / browser.js View on Github external
},{"music-scale/all":13,"riot":16}],6:[function(require,module,exports){
var Scale = require('music-scale/all')
var Chromatic = require('chromatic')

var types = ['one note', 'interval', 'triad', 'cuatriad', 'pentatonic',
'hexatonic', 'heptatonic', 'octatonic', '9 notes', '10 notes', '11 notes', '12 notes']

var NAMES = Scale.Names.names()
var all = [].concat(NAMES)

function isValidPattern (pattern) {
  return pattern &&               // present
    !/^\s*$/.test(pattern) &&     // not empty
    !/^\d$/.test(pattern)         // if number, at least 2 digits
}

function notes (root, binary, len) {
  var x, i
  return Chromatic(root, 4, len).map(function (chroma) {
    var notes = []
    for (x = 0; x < len; x++) {
      i = x % 12
      if (binary[i] === '1') notes.push(chroma[x])
    }
github danigb / music-scale / app / router.js View on Github external
riot.route(function (decimal, name) {
    var scale = /^\d{4}$/.test(decimal) ? Scale.get(+decimal) : null
    if (scale) {
      if (!/^\s*$/.test(name)) {
        name = (name in scale.names()) ? name : scale.name()
        app.select(name || scale.decimal)
      } else {
        route(scale.decimal, scale.name() || scale.binary)
      }
    } else {
      var clean = decodeURIComponent(name)
      scale = Scale.get(clean)
      if (scale) route(scale.decimal, name)
    }
  })
github danigb / music-scale / app / router.js View on Github external
riot.route(function (decimal, name) {
    var scale = /^\d{4}$/.test(decimal) ? Scale.get(+decimal) : null
    if (scale) {
      if (!/^\s*$/.test(name)) {
        name = (name in scale.names()) ? name : scale.name()
        app.select(name || scale.decimal)
      } else {
        route(scale.decimal, scale.name() || scale.binary)
      }
    } else {
      var clean = decodeURIComponent(name)
      scale = Scale.get(clean)
      if (scale) route(scale.decimal, name)
    }
  })
github danigb / music-scale / browser.js View on Github external
riot.route(function (decimal, name) {
    var scale = /^\d{4}$/.test(decimal) ? Scale.get(+decimal) : null
    if (scale) {
      if (!/^\s*$/.test(name)) {
        name = (name in scale.names()) ? name : scale.name()
        app.select(name || scale.decimal)
      } else {
        route(scale.decimal, scale.name() || scale.binary)
      }
    } else {
      var clean = decodeURIComponent(name)
      scale = Scale.get(clean)
      if (scale) route(scale.decimal, name)
    }
  })
github danigb / music-scale / browser.js View on Github external
riot.route(function (decimal, name) {
    var scale = /^\d{4}$/.test(decimal) ? Scale.get(+decimal) : null
    if (scale) {
      if (!/^\s*$/.test(name)) {
        name = (name in scale.names()) ? name : scale.name()
        app.select(name || scale.decimal)
      } else {
        route(scale.decimal, scale.name() || scale.binary)
      }
    } else {
      var clean = decodeURIComponent(name)
      scale = Scale.get(clean)
      if (scale) route(scale.decimal, name)
    }
  })
github danigb / music-scale / app / scales.js View on Github external
get: function (name, root) {
    return scaleData(name, root, Scale.get(name))
  },
  build: function () {
github danigb / music-scale / browser.js View on Github external
get: function (name, root) {
    return scaleData(name, root, Scale.get(name))
  },
  build: function () {
github danigb / music-scale / browser.js View on Github external
},{}],13:[function(require,module,exports){
'use strict'
var Scale = require('./')
Scale.Names({
  '2217': ['lydian #5 pentatonic'],
  '2218': ['whole tone pentatonic'],
  '2225': ['lydian pentatonic', 'chinese'],
  '2226': ['lydian dominant pentatonic'],
  '2257': ['ionian pentatonic'],
  '2258': ['mixolydian pentatonic', 'indian'],
  '2274': ['neopolitan major pentatonic'],
  '2378': ['malkos raga'],
  '2385': ['minor #7 pentatonic'],
  '2386': ['minor pentatonic', 'vietnamese 2'],
  '2388': ['minor six pentatonic'],
  '2392': ['vietnamese 1'],
  '2402': ['locrian pentatonic', 'minor seven flat five pentatonic'],
  '2418': ['minor blues', 'blues'],
  '2457': ['augmented'],
  '2466': ['super locrian pentatonic'],
github danigb / music-scale / browser.js View on Github external
build: function () {
    Scale.all().forEach(function (scale) {
      if (scale.name()) return
      all.push('' + scale.decimal + ' [' + scale.binary + '] ' + types[scale.length - 1])
    })
  }
}

music-scale

Create music scales

MIT
Latest version published 9 years ago

Package Health Score

66 / 100
Full package analysis