Giter Site home page Giter Site logo

titus-ong / chordparser Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 2.0 545 KB

A Python 3 package that provides a musical framework to analyse chords

License: MIT License

Python 77.06% Makefile 0.04% Jupyter Notebook 22.90%
music theory chords roman-numerals transpose-chords chord-progression harmonic-analysis

chordparser's People

Contributors

amelie106 avatar titus-ong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

chordparser's Issues

Set chord notation format

Currently, the chord notation format (Chord.notation) is fixed, and some people may prefer other representations (e.g. C+7 instead of Caug7). Can consider creating a new format class that stores the desired format, and all the classes reference that class when building notation.

Extensions in Quality class

Quality currently has the extension as just a string. Define it with a type (e.g. major, minor or diminished) based on the seventh, and create a method that can return the extension's number as an int.

New class for quality attribute of Chord class

A few of the attributes of the musical classes are objects that need parsing everytime they are accessed (e.g. quality attribute of a Chord). Create new classes for them so they can be easily understood.

EDIT: As description is vague, this issue is STRICTLY for the quality attribute of a Chord. Other classes should be put in a new issue.

Allow key input for ChordAnalyser

Currently, ChordAnalyser only accepts scales for its input, which is inconsistent with ChordRomanConverter which can accept keys. Allow ChordAnalyser to accepts keys as well in its analysing methods.

base chord function in ChordEditor

Quite a lot of useful parsing of chords rely on understanding the base chord (e.g. diminished minor ninth as a diminished chord fundamentally). Create a base chord function in ChordEditor that accepts a chord, strips it of sus, add, ext, (possibly bass - might want to keep inversions), changes the quality to the base quality, and returns the base chord.

Secondary chord class

Create a secondary chord notation class that has repr as {chord1}/{chord2}, and has methods that can provide the two chords and the base scale. For current state, see ChordAnalyser's analyse_secondary function.

Proper roman notation

Currently, the roman notation covers the root, any inversions (up to 7th chords) and the chord quality. I am not sure if there are other aspects of Roman numeral notation that I have missed out regarding sus, added notes, or inversions for 9th/11th etc. chords. Need to research and include these in Roman class.

Duck typing

Some parts of the code has static typing, but the more Pythonic way would be to allow for duck typing. Refactoring the code will be needed to remove the static typed parts.

Add class and editor

The quality and quality editor is currently abstracted into a helper class when creating a Chord. Do the same for added notes.

Helper dictionary list

Lots of the classes use common dictionary lists to convert from symbols to integers, words to short form etc. Collate and put these in a helper class for all the classes to access centrally.

Roman editor

Create a separate class to create roman numerals from chords, and create chords from roman numerals + scale/key. This makes it easier to convert from chords to roman numerals and back by only storing the key the song is in.

Make single responsibility for regex parsing in Chord class clearer

Some methods are too impure as functions to be reusable (e.g. regex parsing in Chord class). Need to refactor code to make each method separate and clear in responsibility. Also look for opportunities to write new methods to avoid repeating code.

EDIT: To make this issue more specific, this issue will ONLY deal with the regex parsing of the Chord class.

Update Colab Notebook

With readthedocs now, the documentation section of the notebook should be moved to /docs, leaving only the working example. With the changes in classes and methods in v0.3.x, the code has to be updated as well.

Scale in ChordRomanConverter

What a great library, thank you! I used it in a project for university and it helped me a lot :)
Something I noticed: in ChordRomanConverter, the scale is hardcoded to 'major', which resulted in some errors in my analysis. I changed it as follows:

from this:

if isinstance(scale_key, Scale):
      scale_root = scale_key.key.root
else:
    scale_root = scale_key.root
scale = self._SE.create_scale(scale_root, "major")

to this:

if isinstance(scale_key, Scale):
    scale_root = scale_key.key.root
    scale = self._SE.create_scale(scale_root, scale_key.key.mode)
else:
    scale_root = scale_key.root
    scale = self._SE.create_scale(scale_root, scale_key.mode)

Happy to hear your thoughts!

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.