Giter Club home page Giter Club logo

noodletab's Introduction

NoodleTab

A Javascript module for making guitar and bass tabs using a shorthand notation.

Usage

var NoodleTab = require("../src/noodle-tab.js");

var phrases = {
	start: "5: 5 7 8 4: 5 5: 7 - 6: 8 5: 5 - 54650# -"
};

var output = NoodleTab.makeTab('start', phrases);
console.log(output);
E|--------------------------------------0-------|
B|--------------------------------------5-------|
G|--------------------------------------6-------|
D|--------------5-----------------------4-------|
A|--5---7---8-------7-----------5-------5-------|
E|--------------------------8-------------------|

Building

This step is only necessary if you want to change the grammar. To rebuild the parser make sure you have Pegjs installed.

npm install -g pegjs

Then run Pegjs with the updated grammar file as the input.

pegjs ./src/noodle-parser.pegjs

This should create a new file ./src/noodle-parser.js

API

makeTab(start, phrases, [format])

Parses a set of phrases and returns a string containing the tab starting from the specified start phrase.

  • Parameters

    • startPhrase: A string containing the name of a phrase to start from.
    • phrases: An object where each key is the id of a phrase and each value is a string representing the phrase in shorthand notation.
    • format: Optional config object with values that control tab formatting
      • autoWidth: if true the last block will be truncated
      • lineWidth: the number of dashes in each tab line
      • noteSpacing: the number of dashes between each note
      • barSpacing: the number of dashes to put after a bar
      • lineCount: the number of tab lines in each block
      • openTunings: an array of strings to specify the tuning of each string

Grammar

NoodleTab uses the following symbols in its phrase notation. Symbols can be separated with spaces, tabs, or newlines.

Symbol Description
<int> Specifies a fret to be played on the current string
<int>: Changes the current string, must be within the range [1 - StringCount] inclusive.
#<int> Specifies a chord using the digits of the integer as frets starting on the lowest string.
<int># Specifies a chord using the digits of the integer as frets ending on the highest string.
- Specifies a rest at the current column which creates space between notes.
| Specifies a measure bar to be printed at the current column
, Starts a new block below the current one.
{<string>} Prints an annotation above the tab at the current column.
@<string> Specifies a phrase with the given id. Phrases cannot contain circular references.
[<string>] Specifies a bracketed sequence containing combinations of the aforementioned symbols.
^<int> Can be placed immediately after a bracketed sequence to shift the string of each note in the sequence.
><int> Can be placed immediately after a bracketed sequence to shift the fret of each note in the sequence.
*<int> Can be placed immediately after a bracketed sequence to repeat it the given number of times.
+ Can be placed between two bracketed sequences to have them be superimposed.

Todo

  • add chords diagrams
  • output to svg or canvas

License

MIT

noodletab's People

Contributors

jrd730 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.