GithubHelp home page GithubHelp logo

tandav / musiclib Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 2.0 1.61 MB

Set of tools to work with scales, modes, modulations, chord progressions, voice leading, rhythm and more

Python 100.00%
chords music-theory music-scales piano voice-leading rhythm midi

musiclib's Introduction

GitHub tag (latest by date)

musiclib

set of tools to work with scales, modes, modulations, chord progressions, voice leading, rhythm and more

install

install from pypi

pip install musiclib

or install the latest version from github

pip install git+https://github.com/tandav/musiclib

development

pip install -e .[dev]

examples

>>> from musiclib.scale import Scale
>>> from musiclib.noteset import SpecificNoteSet
>>> from musiclib.noterange import NoteRange

>>> scale = Scale.from_name('C', 'major')

>>> scale.root
Note('C')

>>> scale.notes
frozenset({Note('C'),
           Note('D'),
           Note('E'),
           Note('F'),
           Note('G'),
           Note('A'),
           Note('B')})

>>> scale.bits
'101011010101'

>>> scale.intervals
frozenset({0, 2, 4, 5, 7, 9, 11})
Scale.from_name('C', 'phrygian')

SpecificNoteSet.from_str('C1_e1_G1_C2_b2_E3')

NoteRange(SpecificNote('C', 1), SpecificNote('B', 3))

musiclib's People

Contributors

dependabot[bot] avatar pre-commit-ci[bot] avatar tandav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

musiclib's Issues

Test all meters , eg 4/2

4/2 means there are 2 whole notes in a bar (not 1 as on 4/4)

maybe this will be confusing notation (whole note no more means 1 bar)

seems like denominator is powrs of 2:

Any time signature can be used, provided it has a numerator between 1 and 99 and a denominator with a beat value of 1, 2, 4, 8 or 16.
https://www.ableton.com/en/manual/session-view/#tracks-and-scenes

maybe this is all useless because note durations in MIDI file are represented by on/off ticks, not by fractions (1,1/2,1/4 etc)

update curr_prev_constraint

it should support not only -1 but also -2, -3, .. -n. candidate_constraint is not good for this because it difficult to handle loop=True case. So general curr_prev_constraint is required , it should support loop=True

save chord transitions checks to sqlite

schema:

  • chord a (str) (eg C3_G5_C6_E7/C)
  • chord b (str)
  • check function name (str)
  • return (bool)

function checks table:

  • check function name (str)
  • function code (str)
  • sha? md5?

improve sequence_builder

  • Add access to prefix in sequence_builder constraints
    For example to check that -1, -2, -3 root notes are not equal to current
  • #66
  • more tests
    • test unique and parallel (theres frozenset usage inside)
  • feature: take callable which generates options for each step. (now you can only iterate through every possible options)
    pass args to that callable
  • upgrade to class
    classmethods for different scenarios: options is iterable, iterable of iterables, callable
  • add caching
    • profile cache, is it used in my algo, maybe computing permutations-like sequences didn't use cache (waste of RAM)
    • its kinda not used (ensure this is not because of some stupid bug) sequence_builder.cache_info(): CacheInfo(hits=0, misses=1397182, maxsize=None, currsize=1397182)
    • maybe some parts of the build / constraint checks can be cached
  • parallel computing
    • test that parallel results are equal to single threaded
    • paralellize sequence_builder (multiprocessing), make an api to compute on server
    • #65
  • fix #49
  • tqdm progressbar
  • use iter, next for SequenceBuilder

sequence_builder(loop=True) not working example

sequence_builder(
    ...
    curr_prev_constraint={-1: no_bad_checks, -2: lambda a, b: not equal_roots(a, b)},
    loop=True,
)

gives this False positive exmple: EDFECD (second D has -2 root == D)
full chords:

[E1_B1_D2_G2_E3/E, D1_C2_F2_A2_C3/D, F1_C2_F2_A2_E3/F, E1_D2_G2_B2_E3/E, C1_C2_E2_B2_G3/C, D1_C2_F2_A2_F3/D]

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.