scale-select

1.0.0 • Public • Published

scale-select

A web component for picking keys/scales

Install with NPM

This module is a fork of openmusic-transport and can I just state for the record that Sole is awesome and I would not be making JavaScript music if not for her work.

TODO: allow user to provide custom list of scales. (or just make a bigger list i guess...)

Installation

Grab index.js from the repo or do npm install scale-select.

If not using any package manager

Include index.js before you use the component:

<script src="index.js"></script>

It will be registered automatically as scale-select, so you can document.createElement('scale-select') or just have <scale-select> elements in your HTML source.

If using npm

You need to load the module and then register it--it is not automatically registered!

require('scale-select').register('scale-select');

But you could even register it with other name, for example:

require('scale-select').register('crass-is-a-pretty-good-band');

Up to you.

Usage

Have a look at demo/demo.js for an example that does things in order to things.

Events

tonic

This event will be dispatched when the tonic select is changed. To listen for tonic events on this component, add an event listener:

component.addEventListener('tonic', function(ev) {
    // do something
  var tonic = ev.detail.value // will be "C" or "D#" or what have you
});

scale

This event will be dispatched when the scale select is changed. To listen for scale events on this component, add an event listener:

component.addEventListener('scale', function(ev) {
  // do something, for example maybe:
  var scale = ev.detail.value // will be "major" or "pentMaj" or what have you
});

Package Sidebar

Install

npm i scale-select

Weekly Downloads

1

Version

1.0.0

License

none

Last publish

Collaborators

  • coleww