1.0.10 • Published 3 years ago

vue-piano-keyboard v1.0.10

Weekly downloads
28
License
MIT
Repository
github
Last release
3 years ago

vue-piano

npm version bundle size

An interactive piano keyboard for Vue. Supports click/keyboard events and some configurations. Try it out.

Installing

npm i vue-piano-keyboard

Alternatively, you can download the UMD build from unpkg.

Usage

Import and use the compoment:

<template>
  <div id="app">
    <PianoKeyboard/>
  </div>
</template>

<script>
import PianoKeyboard  from 'vue-piano-keyboard'

export default {
  name: 'App',
  components: {
    PianoKeyboard
  }
}
</script>

Audio

vue-piano component uses Tone.js library for audio playback of each note, more specifically it uses Tone.Synth (that's why the size of the component it's pretty big).

Props

NameTypeDefault ValueDescription
allKeysArray(all the keyboard numbers/signs/letters) ['a', 's', 'd', ..]An array of keyboard keys which corresponds to musical notes, from left to right the values will be assigned to the piano tiles.
whiteNoteColorString"#1eb7eb"Color for white notes when they are pressed
blackNoteColorString"#f9bb2d"Color for black notes when they are pressed
showKeysBooleanfalseIt will show the key corresponding to each note
showNotesBooleanfalseIt will show the notes corresponding to each tile
startOctaveNumber2The notes will start from startOctave
endOctaveNumber4The notes will end at endOctave
sustainBooleanfalseIt will sustain the note (some more seconds) after you release the key/click

Style

The width (100%) and the height (100%) are adjusted base on the first parent width and height

License

MIT

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.2

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago