1.0.2 • Published 9 years ago

simple-modular-scale v1.0.2

Weekly downloads
5
License
MIT
Repository
-
Last release
9 years ago

Simple Modular Scale

Modular scale based on an array of ratios

Usage

npm i simple-modular-scale
var ms = require('simple-modular-scale')

var scale = ms({
  base: 16,
  ratios: [3/2, 4/3],
  length: 8
})
// [ 16, 24, 32, 48, 64, 96, 128, 192 ]

Options

  • base is the root number from which all values in the scale are derived
  • ratios is an array of numbers that are multiplied by the previous number in the sequence. Ratios are alternated to create a sort of multi-stranded modular scale.
  • length is the total number of values output.

Example

var ms = require('simple-modular-scale', {
  base: 16,
  ratios: [ 9/8, 4/3, 4/3 ],
  length: 8
})
MultiplicandMultiplierProduct
16116
169/818
184/324
244/332
329/836
364/348
484/364
649/872

Starting with a base of 16, the next number added is 16 * 9/8, which is 18. Next 18 is multiplied by ratios[1] or 4/3 to produce 24. Then 24 is multiplied by ratios[2] or 4/3 to produce 32. This sequence continues until an array of length is produced.

MIT License