1.0.2 • Published 6 months ago

guitar-fretboard v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Guitar Fretboard

A lightweight utility to print guitar (or other string instruments) fretboards and retrieve notes for a specific string and fret. Supports various tunings for different string instruments.

Features

Print the entire fretboard for a given tuning. Get the note for a specific string and fret. Predefined tunings for standard and alternate guitar tunings, as well as other string instruments like ukulele, bass, and more.

Installation

Install the package via npm:

npm install guitar-fretboard

Usage

Import the module

const fretboard = require('guitar-fretboard');

Print a fretboard

const standardTuningFretboard = fretboard.printFretboard(12);
console.log(standardTuningFretboard.join('\n'));

Output:

String 1: E | F | F# | G | G# | A | A# | B | C | C# | D | D# | E
String 2: B | C | C# | D | D# | E | F | F# | G | G# | A | A# | B
String 3: G | G# | A | A# | B | C | C# | D | D# | E | F | F# | G

Get a note for a specific string and fret

const note = fretboard.getNote(1, 5); // Get the note on the 1st string at the 5th fret
console.log(note); // Output: A

Use a different tuning

const dropDTuningFretboard = fretboard.printFretboard(12, ['D', 'A', 'D', 'G', 'B', 'E']);
console.log(dropDTuningFretboard.join('\n'));

Supported Tunings

Predefined tunings include:

API

printFretboard(frets = 15, tuning = standardGuitarTuning)

Arguments:

  • frets: Number of frets to display (default: 15).
  • tuning: Array of open string notes (default: standardGuitarTuning).

Returns:

  • Array of strings representing each string's fretboard.
getNote(stringNumber, fret, tuning = standardGuitarTuning)

Arguments:

  • stringNumber: The string number (1-based index, e.g., 1 for the high E string on a guitar).
  • fret: The fret number (0-based, e.g., 0 for open string).
  • tuning: Array of open string notes (default: standardGuitarTuning).

Returns:

The note at the specified string and fret.

License

This project is licensed under the MIT License.

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

7 years ago