1.0.4 • Published 4 years ago

tabtochordpro v1.0.4

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

TabToChordPro

JavaScript module to convert regular tab files to the ChordPro format.

Installation and use

  1. Add the TabToChordPro package to your project with npm:
    npm install tabtochordpro
  2. Use require in the file where you would like to make use for it:
    const tabToChordPro = require('TabToChordpro')
  3. There is only one method to use:

    tabToChordPro.tabToChordPro(tab, artist, title, capo, key, outputSong);

    Parameters:

    • tab (string): The contents of the tab file. For example a string that contains the following:
    Bm7                                 G      D/F#   Em   G   D/F#   Em
    In pitch dark I go walking in your landscape.
    Bm7                           G     D/F#   Em   G   D/F#   Em
    Broken branches trip me as I speak.
    • artist (string), title (string), capo (int), key (string): Metadata of the song. All of these may be null or undefined if you do not want them in your ChordPro file.

    • outputSong: This is the callback method wich will contain a parameter that will hold the output. For example, you could define a method to a variable to handle the output:

    const outputSong = (converted) => { console.log(converted) }

    Then pass this variable to the procedure as a parameter. If this callback procedure is not provided, this method will simply return a string containing the song in ChordPro format.

Simple example

const tabToChordPro = require('TabToChordpro')

let tab = `
    Bm7                                 G      D/F#   Em   G   D/F#   Em
In pitch dark I go walking in your landscape.
Bm7                           G     D/F#   Em   G   D/F#   Em
Broken branches trip me as I speak.`

console.log(tabToChordPro.tabToChordPro(tab))

Outputs:

In p[Bm7]itch dark I go walking in your lands[G]cape.[D/F#][Em][G][D/F#][Em]
[Bm7]Broken branches trip me as I s[G]peak.[D/F#][Em][G][D/F#][Em]
1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago