0.1.2 • Published 6 years ago

twelvetet-fretboard v0.1.2

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

TwelveTetFretboard

TwelveTetFretboard is a small fretboard utility library for Javascript. It helps you manipulate pitches on a fretboard.

Please, refer to the Installation, Usage and API sections for more information.

Installation

Install the latest stable version of TwelveTetFretboard using npm:

npm install twelvetet-fretboard twelvetet

You can also access the files on unpkg.com.

You can use TwelveTetFretboard with module bundlers.

The npm package includes precompiled production and development UMD builds in the dist/ folder. They can be used without a bundler.

The UMD builds make TwelveTetFretboard available as window.TwelveTetFretboard global variable.

TwelveTetFretboard works in any modern browser and Node.js.

Usage

import Fretboard from 'twelvetet-fretboard'

const tuning = ['E2', 'A2', 'D3', 'G3', 'B3', 'E4'] // standard guitar tuning
const numFrets = 12
const fretboard = new Fretboard(tuning, numFrets)

console.log(fretboard.at(0, 0).toString())          // E4

API

Classes

Typedefs

TwelveTetFretboard

Kind: global class

new TwelveTetFretboard(tuning, numFrets, tuningFrequency)

ParamTypeDescription
tuningArrayAn array of values representing fretboard tuning.
numFretsNumberA positive integer indicating the number of frets.
tuningFrequencyNumberAn optional positive number indicating the tuning frequency.

Example

import Fretboard from 'twelvetet-fretboard'

const tuning = ['E2', 'A2', 'D3', 'G3', 'B3', 'E4'] // standard guitar tuning
const numFrets = 12
const fretboard = new Fretboard(tuning, numFrets)

console.log(fretboard.at(0, 0).toString())          // E4

twelveTetFretboard.positions

Kind: instance property of TwelveTetFretboard
Properties

NameTypeDescription
positionsArray.<Position>An array of all the positions on the fretboard

twelveTetFretboard.at(aStringIndex, aFretIndex) ⇒ Pitch

Returns the pitch at (stringIndex, fretIndex)

Kind: instance method of TwelveTetFretboard

ParamTypeDescription
aStringIndexNumberA zero-based integer indicating the string
aFretIndexNumberA zero-based integer indicating the fret

Position

Kind: global typedef
Properties

NameTypeDescription
pitchPitchThe pitch at (stringIndex, fretIndex).
stringIndexNumberA zero-based integer indicating the string
fretIndexNumberA zero-based integer indicating the fret

License

This project is MIT-licensed