twelvetet-fretboard

0.1.2 • Public • Published

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

TwelveTetFretboard

Typedefs

Position

TwelveTetFretboard

Kind: global class

new TwelveTetFretboard(tuning, numFrets, [tuningFrequency])

Param Type Description
tuning Array An array of values representing fretboard tuning.
numFrets Number A positive integer indicating the number of frets.
[tuningFrequency] Number An 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

Name Type Description
positions Array.<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

Param Type Description
aStringIndex Number A zero-based integer indicating the string
aFretIndex Number A zero-based integer indicating the fret

Position

Kind: global typedef
Properties

Name Type Description
pitch Pitch The pitch at (stringIndex, fretIndex).
stringIndex Number A zero-based integer indicating the string
fretIndex Number A zero-based integer indicating the fret

License

This project is MIT-licensed

Dependencies (0)

    Dev Dependencies (29)

    Package Sidebar

    Install

    npm i twelvetet-fretboard

    Weekly Downloads

    6

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    31.5 kB

    Total Files

    10

    Last publish

    Collaborators

    • adigiovanni