Nutritious Pomegranate Muffins

    @theoryofnekomata/piano-keyboard

    1.0.2 • Public • Published

    piano-keyboard

    A piano keyboard in JavaScript.

    Why?

    • Because most JavaScript keyboards aren't simple and customizable enough.
    • I'm creating a piano roll control, so it needs a piano keyboard to work.
    • This is ideal for music software that utilizes keyboards.

    Installation

    NPM:

    $ npm install --save @theoryofnekomata/piano-keyboard
    

    Bower:

    $ bower install --save piano-keyboard
    

    Usage

    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) {
        // ...    
    });
    
    // ...

    License

    MIT. See LICENSE file for details.

    Install

    npm i @theoryofnekomata/piano-keyboard

    DownloadsWeekly Downloads

    0

    Version

    1.0.2

    License

    MIT

    Last publish

    Collaborators

    • theoryofnekomata