1.0.3 • Published 3 years ago

vue-guitar-tuner v1.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

Vue Guitar Tuner

This is a UI enhanced guitar tuner package, using Vue.js hooks

Vue Guitar Tuner is a mobile-ready, customisable, Vue.js-powered guitar tuner.

WARNING: vue-guitar-tuner is at alpha stage of development and may undergo significant changes.

Feel free to submit issues and feature requests here.

Demo Page

Table of Contents

Installation

npm install vue-guitar-tuner

or if you prefer yarn

yarn add vue-guitar-tuner

Usage

Global

You may install Vue Guitar Tuner globally:

import Vue from 'vue';
import VueGuitarTuner from 'vue-guitar-tuner';

Vue.use(VueGuitarTuner);

This will make <VueGuitarTuner> available to all components within your Vue app.

Local

Include the tuner directly into your component using import:

import VueGuitarTuner from 'vue-guitar-tuner';

export default {
  ...
  components: {
    VueGuitarTuner,
  }
  ...
};

Styles

Include demo styles using import:

import("vue-guitar-tuner/dist/vue-guitar-tuner.css");

Configuration

PropertyTypeDefaultDescription
displayNoteBooleantrueFlag to enable or disable note display.
displayReferenceLineBooleantrueFlag to enable or disable the vertical reference line.
displayGridBooleantrueFlag to enable or disable background grid.
notesArray'C', ..., 'B'An array of Strings that define the 12 notes displayed on note area. Default value: "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B". Must be an array of 12 strings.
tunerClassesArray'tuner'An Array of CSS Classes to customise tuner area.
gridClassesArray'gridOverlay'An array of CSS Classes to customise Grid area.
detuneClassesArray'detune'An Array of CSS Classes to customise Detune area.
detuneTipClassesArray'detuneTip'An Array of CSS Classes to customise the Detune Tip.
detuneValueClassesArray'detuneValue'An Array of CSS Classes to customise the Detune Value.
keySignatureClassesArray'keySignature'An Array of CSS Classes to customise both of the key signatures (flat, sharp).
flatClassesArray'tuner'An Array of CSS Classes to customise the flat character.
sharpClassesArray'tuner'An Array of CSS Classes to customise the sharp character.

Events

EventTypeDescription
dataUpdateObjectEmits whenever there's a new value available. Object includes { pitch: Number, note: Number, detune: Number }
statusUpdateBooleanEmits whenever the recording statues changes.

Actions

ActionDescription
this.$root.$toggleGuitarTuner()Toggles the tuner on and off depending on the current recording status.

HTML Structure

Once the VueguitarTuner component is installed globally or imported, it can be used in templates in the following manner:

  <VueGuitarTuner :display-note="false" :displayGrid="false" :tunerClasses="['tuner, 'tunerArea']"/>

To listen for the dataUpdate and statusUpdate events you can do the following:

  <VueGuitarTuner @statusUpdate="statusUpdate" @dataUpdate="dataUpdate" />
export default {
    ...
    data() {
        return {
            isTunerActive: false,
            data: {},
        };
    },
    ...
    methods: {
        statusUpdate(status) {
            this.isTunerActive = status;
        },
        dataUpdate(data) {
            this.data = data;
        },
    },
    ...
}

Development

A sandboxed dev environment is provided by vue-play. Changes made to the component files will appear in real time in the sandbox.

To begin development, run:

yarn install
yarn dev

then navigate to http://localhost:5000

To modify and add sandbox scenarios, edit play/index.js

License

This project is licensed under the Apache License - see the LICENCE file for details.