Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access unprocessed sheet tokens #2

Open
felixroos opened this issue Feb 25, 2019 · 1 comment
Open

access unprocessed sheet tokens #2

felixroos opened this issue Feb 25, 2019 · 1 comment

Comments

@felixroos
Copy link

felixroos commented Feb 25, 2019

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

@pianosnake
Copy link
Owner

Nice work on the jazzband site! Go ahead and submit PR. It would be good to have an option for both types of outputs:
• raw serial output of chords as it is now for easy chord progression finding and corpus analysis
• your suggested lossless JSON

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants