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 tuningconst numFrets = 12const 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])
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
const tuning = 'E2' 'A2' 'D3' 'G3' 'B3' 'E4' // standard guitar tuningconst numFrets = 12const fretboard = tuning numFrets console // E4
twelveTetFretboard.positions
Kind: instance property of TwelveTetFretboard
Properties
Name | Type | Description |
---|---|---|
positions | Array.<Position> |
An array of all the positions on the fretboard |
Pitch
twelveTetFretboard.at(aStringIndex, aFretIndex) ⇒ 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