tabtochordpro
v1.0.4
Published
Convert regular tab files to ChordPro files
Readme
TabToChordPro
JavaScript module to convert regular tab files to the ChordPro format.
Installation and use
Add the
TabToChordPropackage to your project with npm:npm install tabtochordproUse
requirein the file where you would like to make use for it:const tabToChordPro = require('TabToChordpro')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 benullorundefinedif 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
stringcontaining 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]