Skip to content

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

License

Notifications You must be signed in to change notification settings

svrebos/TabToChordPro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published