Code Monkey home page Code Monkey logo

tabtochordpro's Introduction

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]

tabtochordpro's People

Contributors

svrebos avatar

Stargazers

 avatar  avatar  avatar

Watchers

 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.