npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ireal-reader

v1.3.1

Published

Read iReal Pro files into JS

Downloads

30

Readme

iReal Reader

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

The output is a JS object similar to the one shown below. Repeated measures, endings, segnos and codas are all expanded and written out serially in one array.

{
  name: 'Swing Tunes',
  songs:
   [ {
       title: 'All Of Me',
       composer: 'Marks Gerald',
       style: 'Medium Swing',
       key: 'C',
       transpose: null,
       compStyle: '0',
       bpm: 100,
       repeats: 3,
       music: {
          timeSignature: '44',
          raw: '[*AT44C^7XyQKcl LZEadd9XyQKcl LZAsus A7susadd3LZsA, ,lBLZD-7XyQKcl  ][*BE7XyQKcl LZA-7XyQKcl LZD7XyQKcl LZD-7XyQ|G7XyQ][*AC^7XyQKcl LZE7XyQKcl LZA7XyQKcl LZD-7XyQKcl  ][*CF^7XyQ|F-6(F#o7)XyQ|E-7(C^7/G)XyQ|A7XyQ|D-7XyQ|G7XyQ|C6 Ebo7LZD-7 G7 Z',
          measures:
            [
              ['C^7'], ['C^7'], ['Eadd9'], ['Eadd9'],
              ['Asus', 'A7susadd3'], ['A', 'B'], ['D-7'], ['D-7'],
              ['E7'], ['E7'], ['A-7'], ['A-7'],
              ['D7'], ['D7'], ['D-7'], ['G7'],
              ['C^7'], ['C^7'], ['E7'], ['E7'],
              ['A7'], ['A7'], ['D-7'], ['D-7'],
              ['F^7'], ['F-6', 'F#o7'], ['E-7', 'C^7/G'], ['A7'],
              ['D-7'], ['G7'], ['C6', 'Ebo7'], ['D-7', 'G7']]
          }
       }
     ...
   ]
}

Usage

Install the module with npm install ireal-reader. To save to your projects package.json, use npm install ireal-reader --save.

Then, in your project, read in the HTML or ireal://... url output from iRealPro.

JavaScript

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

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 = iRealReader(data);
}

TypeScript

The example below shows how to read the music from an HTML file using TypeScript.

First, in your project, npm install ireal-reader-1.3.0.tgz --save. Also, for example, if you are using Angular2, you might need a irealreader.d.ts file containing the text declare module 'ireal-reader'; in your app folder.

Then, load this library in your TypeScript class like so:

import * as iRealReader from 'ireal-reader';

Then, call it:

const iRealHtml: string = '<HTML ...';
const iRealJson = iRealReader(iRealHtml);

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.

License

MIT License