GithubHelp home page GithubHelp logo

pianosnake / ireal-reader Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 8.0 95 KB

A Node JS module to read music files from iRealPro.

JavaScript 65.53% HTML 34.47%
music-information-retrieval nodejs ireal-reader irealpro

ireal-reader's People

Contributors

djangofan avatar jjp avatar pianosnake avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ireal-reader's Issues

Parsing chords with "add" and "sus" is broken

Hi,
thanks for this nice library! I use it to extract chord progressions. When doing some tests, I saw that chords containing "add" and "sus" are not correctly parsed. I guess this is due to the fact that they are not captured by this regexp expression.

Are you interested in me working on this? I'd like to understand why it's necessary to do the regexp matching so strictly. Can we just add 'a', 'd', 's', and 'u' to the character classes - which would allow "add" and "sus" but also allow rubbish like "Caus"? Or do you think it should be a proper regexp that refuses wrong chords?

Cheers, Boris

access unprocessed sheet tokens

Hey there, nice work!
Would you accept a pull request that extends the lib with a method to return all unprocessed ireal tokens? I am currently tinkering with leadsheets, trying to get a nice format for a playalong lib. The unscrambling and parsing of the song data works well will ireal-reader, but the returned measures lack the meta info (repeat signs, sections, comments etc).
My current solution is a combination of your lib to parse the links + modified parts of ireal-renderer to get the raw ireal tokens. The parsed tokens look like this:

[
  {
    "annots": [
      "*A", // section A
      "T44", // 44 time
      "{" // repeat start
    ],
    "comments": [],
    "bars": "{",
    "spacer": 0,
    "chord": {
      "note": "E",
      "modifiers": "h7",
      "over": null,
      "alternate": null
    },
    "token": " "
  },
  { // this is just empty space
    "annots": [],
    "comments": [],
    "bars": "",
    "spacer": 0,
    "chord": null,
    "token": " "
  },
  /* ... */
  {
    "annots": [],
    "comments": [],
    "bars": "Z", // last bar
    "spacer": 0,
    "chord": null
  }
]

At this point, no information of the sheet is lost. To simplify the format, I can then parse the tokens to a format that omits everything that is just layout related (empty spacers, unused props):

[
    {
        "chords": ["Eh7"],
        "section": "A",
        "time": "44",
        "signs": ["{"]
    },
    {
        "chords": ["A7b9"]
    },
    /* ... */
    {
        "chords": ["Eh7", "A7b9"]
    },
    {
        "chords": ["D-"],
        "section": "B",
        "house": 1
    },
    {
        "chords": ["G-7"]
    },
   /* .. */
    {
        "chords": ["A7b9"],
        "signs": ["}"]
    },
    {
        "chords": ["D-"],
        "section": "C",
        "house": 2
    },
    {
        "chords": ["G-7"]
    },
    /* .. */
    {
        "chords": ["D-"]
    }
]

This format is suitable for rendering a sheet visually. To render it aurally, all repeat signs/houses must be resolved.
I am also using another snippet format that allows easy editing with a textarea:

|: Eh7    |  A7b9         |  D-   |  D-        |
|  G-7    |  C7           |  F^7  |  Eh7 A7b9  |
|1 D-     |  G-7          |  Bb7  |  A7b9      |
|  D-     |  G7#11        |  Eh7  |  A7b9     :|
|2 D-     |  G-7          |  Bb7  |  A7b9      |
|  D- B7  |  Bb7#11 A7b9  |  D-   |  D-        |

If you want, you can play around with it here.
To spare you from more details, I would be happy if this lib could handle the token magic, maybe even parsing the tokens to the format of the second snippet I wrote.
Greetings,
Felix

TypeError: Cannot read properties of null (reading '1')

I found the error below after running the code.
May I get some help please?
Error:

 const percentDecoded = decodeURIComponent(percentEncoded[1]);
                                                          ^

TypeError: Cannot read properties of null (reading '1')

Code:

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

fs.readFile("./On The Sunny Side Of The Street.xml", "utf8", function (err, data) {
  if (err) throw err;
  const playlist = iRealReader(data);
  console.log(playlist);
});

On The Sunny Side Of The Street.txt

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.