https://github.com/jjgonecrypto/node-keyboard-shapes
Object shape mapper for node-keyboard - converts objects into chords
https://github.com/jjgonecrypto/node-keyboard-shapes
chords music node-keyboard shapes
Last synced: 6 months ago
JSON representation
Object shape mapper for node-keyboard - converts objects into chords
- Host: GitHub
- URL: https://github.com/jjgonecrypto/node-keyboard-shapes
- Owner: jjgonecrypto
- License: mit
- Created: 2017-04-27T01:54:25.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-10T21:01:06.000Z (over 8 years ago)
- Last Synced: 2024-09-19T10:17:26.997Z (about 1 year ago)
- Topics: chords, music, node-keyboard, shapes
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# node-keyboard-shapes
[](https://badge.fury.io/js/node-keyboard-shapes)
Object shape mapper for [node-keyboard](http://github.com/justinjmoses/node-keyboard) - coverts objects into chords!

## Installation
### As Global
If you installed node-keyboard globally, then install this plugin via `npm i -g node-keyboard-shapes`Then start node keyboard via `node-keyboard`, and import this plugin via `const shapes = requireg('node-keyboard-shapes')`
### As Local
If instead you cloned node-keyboard, then install locally in that folder via `npm i node-keyboard-shapes`Then start node keyboard via `node keyboard` and import this plugin via `const shapes = require('node-keyboard-shapes')`
## API
```javascript
shapes.objToChord(key = 'C3', intervalMap = (key, value, object) => ['1P', '3m'])(inputObject)
// returns { intervals: [...], notes: [...], chords: [...] }
````intervalMap` takes the `key`, `value` and `object` and must return `intervals`.
`intervals` may be a string or an array of strings. Should map to a string representation of a musical interval. See [tonal docs](http://danigb.github.io/tonal/api/module-harmonizer.html).Provided maps:
* `shapes.map.byType.standard` (Default)```javascript
shapes.createObjectListener(handler = (key, value) => {}, obj = {})
// returns new object that will invoke the handler every time a property is set
```## Examples
* [type mapping](./examples/01_typeMapper.js)
* [custom mapping](./examples/02_customMapper.js)
* [object listener](./examples/03_listener.js)