Git Product home page Git Product logo

pyrealparser's Introduction

pyRealParser

A Python package to read songs in the iRealPro format.

Introduction & Usage

Here's an example of how to import an iReal link and print the information it contains:

>from pyRealParser import Tune
>my_tune = Tune.parse_ireal_url('irealb://%44%65%61%72<link shortened>')[0]
>print(my_tune)

<pyRealParser.Tune object at 0x107305e80>
Title: Dear Old Stockholm
Composer: Traditional
Style: Medium Swing
Key: D-
Transpose: None
Comp style: 0
BPM: 0
Repeats: None
Time signature: 4/4

Chord string:
*A{T44D- |Eh7 A7b9|G-7 C7|F^7 |Eh7 A7b9|D- |Eh7 |A7b9 |D-7 |D-6 |D-7 |D-6 }*B[F^7 |G-7 C7|F^7 |Eh7 A7b9 ]*C[D- |Eh7 A7b9|G-7 C7|F^7 |Eh7 A7b9|D- |C7sus |x |C7sus |x |x |x |C7sus A7b9|D- |x

Flattened measures:
| D-          | Eh7A7b9     | G-7C7       | F^7         |
| Eh7A7b9     | D-          | Eh7         | A7b9        |
| D-7         | D-6         | D-7         | D-6         |
| D-          | Eh7A7b9     | G-7C7       | F^7         |
| Eh7A7b9     | D-          | Eh7         | A7b9        |
| D-7         | D-6         | D-7         | D-6         |
| F^7         | G-7C7       | F^7         | Eh7A7b9     |
| D-          | Eh7A7b9     | G-7C7       | F^7         |
| Eh7A7b9     | D-          | C7sus       | C7sus       |
| C7sus       | C7sus       | C7sus       | C7sus       |
| C7susA7b9   | D-          | D-          |

parse_ireal_urlreturns a list of Tune objects, each representing a song contained in the input url. They contain a number of member variables, containing the chords as well as some meta information:

  • chord_string: A single string that has all chords of the tune, with bar lines, repeat markers, endings, codas etc:
>print(my_tune.chord_string)

*A{T44D- |Eh7 A7b9|G-7 C7|F^7 |Eh7 A7b9|D- |Eh7 |A7b9 |D-7 |D-6 |D-7 |D-6 }*B[F^7 |G-7 C7|F^7 |Eh7 A7b9 ]*C[D- |Eh7 A7b9|G-7 C7|F^7 |Eh7 A7b9|D- |C7sus |x |C7sus |x |x |x |C7sus A7b9|D- |x
  • measures_as_strings: A list, for which every element corresponds to a single bar, containing the chords in string form. Repeats, codas etc. have been flattened.
>print(my_tune.measures_as_strings)

*['D-', 'Eh7A7b9', 'G-7C7', 'F^7', 'Eh7A7b9', 'D-', 'Eh7', 'A7b9', 'D-7', 'D-6', 'D-7', 'D-6', 'D-', 'Eh7A7b9', 'G-7C7', 'F^7', 'Eh7A7b9', 'D-', 'Eh7', 'A7b9', 'D-7', 'D-6', 'D-7', 'D-6', 'F^7', 'G-7C7', 'F^7', 'Eh7A7b9', 'D-', 'Eh7A7b9', 'G-7C7', 'F^7', 'Eh7A7b9', 'D-', 'C7sus', 'C7sus', 'C7sus', 'C7sus', 'C7sus', 'C7sus', 'C7susA7b9', 'D-', 'D-']
  • title: The title
  • composer: The composer
  • style: The style (e.g. 'Swing', 'Bossa', 'Blues' etc.)
  • key: The key (e.g. 'A', 'F#' etc)
  • transpose: How many semitones to transpose
  • comp_style: Accompaniment style (usually empty)
  • bpm: Tempo in BPM (usually empty)
  • repeats: How many repeats (usually empty)
  • time_signature: Time signature as a tuple (e.g. (3,4), (4, 4), (5, 8) etc.)

Notice, that some of these meta-data fields might be empty, depending on the input url.

Tune objects are designed to have a nice textual representation in Jupyter notebooks, but can be used outside of a notebook perfectly well.

For more documentation, please read the code.

Contributions are welcome, please submit a PR.

Installation

pip install pyRealParser

Acknowledgements

Kudos to @pianosnake and @ironss for figuring out the iReal url format!

pyrealparser's People

Contributors

drs251 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

Watchers

 avatar  avatar  avatar

pyrealparser's Issues

Information on the status of this project

Hello, we have spotted a number of inconsistencies and errors/bugs in this repository, and we would like to know if the project is still actively maintained or not. Thanks for this fantastic project!

Scrambler utility

Has somebody tried to recreate scrambled chord strings programmatically?

I've tried to generate a playlist modifying the URLs that come out of pyrealpro, but it seems to me that long URLs are expected to be scrambled.
Given that you put together the unscrambler I was wondering whether you had tried to build a scrambler.

Any help/hint on whether building such a scrambler is possible and whether that would solve the problem of generating a playlist will be very much appreciated.

Cheers

measures_as_strings: how to split chords in the same measure?

Hi! Thanks for this nice piece of work :)

I love the ability to extract a flattened sequence of chords. However, the measures_as_strings returns chords in the same measures attached together as single string without separation. Is this intended? How to distinguish them and (eventually) know the relative duration?

For example,

print(my_tune.measures_as_strings)

*['D-', 'Eh7A7b9', 'G-7C7', 'F^7', 'Eh7A7b9', 'D-', 'Eh7', 'A7b9', 'D-7', 'D-6', 'D-7', 'D-6', 'D-', 'Eh7A7b9', 'G-7C7', 'F^7', 'Eh7A7b9', 'D-', 'Eh7', 'A7b9', 'D-7', 'D-6', 'D-7', 'D-6', 'F^7', 'G-7C7', 'F^7', 'Eh7A7b9', 'D-', 'Eh7A7b9', 'G-7C7', 'F^7', 'Eh7A7b9', 'D-', 'C7sus', 'C7sus', 'C7sus', 'C7sus', 'C7sus', 'C7sus', 'C7susA7b9', 'D-', 'D-']

I would like to know that in measure 2 there are 2 chords each one occupying half of the measure 'Eh7A7b9' => 'Eh7 A7b9'. I wonder how to treat the case where you have three chords, e.g. C (repeat) F G`, where the first chord occupies 2 bits.

_get_measures method not working 100%

Just wanted to point out / remind myself that _get_measures still has some shortcomings, especially with regards to segno and fine, if you find the letters S and U mixed in with the chords, this is the reason.

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.