A piano keyboard in JavaScript.
NPM:
$ npm install --save @theoryofnekomata/piano-keyboard
Bower:
$ bower install --save piano-keyboard
In your HTML:
<!-- ... -->
<div id="piano-element" data-white-key-width="auto"></div>
<!-- ... -->
In your JavaScript:
// ...
var pianoElement = document.getElementById('piano-element');
new PianoKeyboard(pianoElement);
pianoElement.addEventListener('noteon', function onNoteOn(e) {
// ...
});
pianoElement.addEventListener('noteoff', function onNoteOff(e) {
// ...
});
// ...
MIT. See LICENSE file for details.