zawiasam / ireal-reader

A Node JS module to read music files from iRealPro.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iReal Reader

This is a Node JS module to read music files from iRealPro.

The output is a JS object similar to the following:

{
  name: 'Playlist name',
  songs:
   [ Song {
       title: 'Craigslistlieder',
       composer: 'G. Kahane',
       style: 'Medium Swing',
       key: 'C',
       transpose: null,
       compStyle: '0',
       bpm: 180,
       repeats: 3,
       music: {
          raw: '*AT44C-9 Db9LZ x LZXyQr|XyQLZC-9, ...',
          measures:
            [[ 'C-9', 'Db9'],
             [ 'C-9', 'Db9'],
              ...
            ]
          }
       }
     ...
   ]
}

Usage

Install the module with npm install ireal-reader. In your project read in the HTML or ireal://... url output from iRealPro.

The example below shows how to read the music from an HTML file:

const fs = require('fs');
const iRealReader = require('ireal-reader');

fs.readFile("ireal-output-file.html", "utf8", function(err, data) {
    if (err) throw err;
    const playlist = new iRealReader(data);
}

Developing

Feel free to fork or submit pull requests. Run tests with npm test

To develop and use the project locally, use npm pack. This will create a .tgz file that can be used locally by other modules. In your other project do npm install path/to/ireal-reader-xxx.tgz

Acknowledgments

The irealb schema was originally cracked by Stephen Irons' Accompaniser. The JSON format is a simplification of Ben Hughes' Chords JSON format.

About

A Node JS module to read music files from iRealPro.


Languages

Language:JavaScript 60.1%Language:HTML 39.9%