Code Monkey home page Code Monkey logo

luke-poeppel / decitala Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 50.89 MB

Rhythmic Search and Alignment Tools for Computational Musicology. Catered to ethnological rhythmic analysis of Olivier Messiaen's music.

Home Page: https://luke-poeppel.github.io/decitala/

License: MIT License

Python 76.31% CSS 3.58% JavaScript 19.74% Makefile 0.17% Batchfile 0.20%
messiaen music21 computational-musicology rhythm search-algorithm carnatic-music greek history india

decitala's Introduction

decitala

Wiki Actions Status codecov img DOI

The decitala package aims to make rhythmic search and analysis of encoded musical corpora easier. This toolkit can be used to both detect rhythmic fragments in a work and suggest possible alignments. decitala is being developed to make the analysis of Olivier Messiaen's music easier, particularly with respect to his use of ethnological rhythmic fragments. If you find the tools/corpora to be useful or discover a bug, feel free to file an Issue or drop me a note ([email protected]). I'd love to hear about how you used them and/or take suggestions.

The Sudhākaraḥ commentary on the opening of Śārngadeva's desītāla definitions (appearing in the Tālādhyāya of the Saṅgītaratnākara).

-"On the Sūtra beginning with 'laghu': having set forth the tālas definition, the author explains them sequentially. One laghu (|) is āditāla (1) two drutas, one laghu (o o |) is the dvitiya tāla (2) one druta, two druta viramas (o oc oc) is the tṛtīya tāla (3) two laghus, one druta (| | o) is the caturtha tāla (4) both drutas (o o) is pacchamaḥ (5) two plutas, two gurus, one laghu (Sc Sc S S |) is niḥśaṅkalīlaḥ (6) |" (Translation by Luke Poeppel)

Documentation

Available at: https://luke-poeppel.github.io/decitala/.

Installation

This package requires music21 which is available here. It is recommended you download this library separately as its installation helper will set some useful preferences for you (like default notation software).

$ cd # Navigate to home directory
$ git clone https://github.com/Luke-Poeppel/decitala.git
$ cd decitala
$ pip3 install -e .
$ pre-commit install
$ decitala --version # Check for proper installation.

If you would like to use the vis.create_tree_diagram function, it requires several additional installation steps. These steps are available in the documentation. It is also recommended that you download the following application for viewing SQLite databases: sqlite-browser.

Citation

If you use decitala, please cite its DOI:

DOI

Why is it called decitala?

Śārngadeva (शार्ङ्गदेव) compiled a list of 130 rhythmic fragments called desītālas (देसी ताल) in his 13th-century musicological treatise, the Sangītaratnākara (सङ्गीतरत्नाकर). Messiaen used the gallicized "deçi-tâlas" in his writing which has been simplified here to "decitala."

decitala's People

Contributors

luke-poeppel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

decitala's Issues

Refactored create_database bug

A failure to reference the logger in the _make_paths_table helper function forces the paths table creation in create_database to fail early.
Screen Shot 2021-02-05 at 7 27 55 PM

Naming system for Decitala objects

In the current system, if you call something like Decitala('Sama'), you actually get <decitala.Decitala 65_C_Kankala_Sama>. We can't revert to just id numbers due to subtalas. There may be a simple solution to this with Regex.

  • should definitely be naming-specific Errors; currently, it spits out some scary stuff when it could instead just say "that name is a problem".
  • I think it should accommodate for lowercase issues. I tried to create a Decitala('Kankala_khanda') object and it gave the error (above) because of the lowercase second k. This is an easy fix; just do name.split('_')[-1][0].upper(), or something similar to that.
  • I'm not sure if this is an issue, but note the fact that talas with subtalas (e.g. 65) all have the same id num. But this is probably better since they're then all the same type. But this is a problem for histogram plotting. Maybe add a parameter called full_id that returns a string with the subtala index, if required?

FragmentTree instantiation as class method

Instead of having the confusing logic in the init to FragmentTree that checks for data/rep-type/frag-type, just have a class method for instantiating from frag_type, i.e. the default FragmentTree is made from a list of GeneralFragment/Decitala/GreekFoot objects and you'll have FragmentTree.from_frag_type("decitala"), for example.

Can't retrieve Varied_Ragavardhana as a Decitala object

This is probably because of the ID situation. I should probably rename it and assign it an arbitrary value like 500. Update: although the ID is an issue (see the wiki), I think the actual problem is that the file has an .mxl extension rather than an .xml extension; there's something in the if name: part of the script that needs to be fixed. I added a temporary solution to the database.py file.

SQL insertion error (OperationalError) for particular configuration

The following parameters were used for a query on Liturgie de Cristal:

create_database(
    db_path = "/Users/lukepoeppel/TISMIR_Messiaen_2021/db/liturgie_3.db",
    filepath = liturgie_path,
    part_num = 3,
    frag_types = ["decitala"],
    allowed_modifications = ["r", "rr", "d", "rd", "rsr"],
    windows = [4, 5, 6, 7, 8, 9],
    filter_found_single_anga_class = True,
    filter_found_sub_fragments = False,
    write_logs_to_file = True,
    verbose = True

It returned the following error:
Screen Shot 2021-02-03 at 9 40 29 PM

DSeg FragmentTree?

It could be cool to explore the idea of a (rooted) dseg and reduced-dseg fragment tree (using a dseg rep-type).

Documentation

The package is getting big enough that it would be useful (just for myself) to have a simple documentation page. Check out a few services like Sphinx.

Extendable _create_fragment_database.

This function is currently included, but meant to not be touched. Additionally, it's not extendable at all –– it's limited only to two representations of two fragment classes. But as I add more rhythmic datasets (e.g. the Astaara tala dataset), this has to be more malleable.

Maybe the following would work:

  • Package includes built-in datasets+classes for the fragment types (e.g. Decitala, GreekFoot).
  • If a new dataset is added, update some config file but use the GeneralFragment data type.

Database for storing fragments?

Having to use converter.parse on > 130 files each time, for instance, a RatioTree is created seems inefficient. Perhaps it would make more sense to create a decitala.db and prosodic_feet.db instead? The whole package would run much faster.

License

Need to pick a license before distributing on Pypi.

Pitch content in database creation

Currently only retrieves pitch information for individual pitches; but if there are chords, it flattens the data. I'm sure there's an easy fix, it's just a tricky script to read through.

FragmentTree/NaryTree size is not correct

The following tree has a size of 3 which is wrong (it should be 5).

test_tree = FragmentTree(data=[GeneralFragment([0.25, 0.25, 0.25], GeneralFragment([0.5, 1.0, 0.5]))])

Enumeration in database.py

Just learned you can enumerate from any start parameter :-). Fix all of those complicate lines in database.py.

Doctest runner in CI

I can just use --doctest-modules from pytest for the CI (Travis or Github actions). The file can still stay––useful for debugging––but not needed for CI.

Time complexity improvement in rolling_tree_search?

Could potentially speed up by creating set of Decitala.ql_tuple that gets checked for each search. Worst case of x in set() is O(n). May get false-negatives for altered fragments –– could potentially add altered and original?

Updating the database.py tests

I think it would be a better idea if, rather than including static databases in the tests folder (which will never change, even if the package changes), we create the DBs in a tempfile and read them on the fly. This would make testing much more effective –– as is evidenced by v0.6.3.

Split trees.py module

The trees.py module is getting a bit big. Since I may end up implementing a KD tree with NN search, I think it makes more sense to take all of the searching functions (rolling_search and get_by_ql_array) and put them in a search.py module.

Candrakala Ratio Representation

If you run a search on [0.5, 0.5, 0.5, 0.75, 0.75, 0.75, 0.25], it'll return Candrakala under a ratio representation of 1.0 –– but this is wrong; it's actually a ratio representation of 0.5.

Name in FragmentTree.from_frag_type

FragmentTrees instantiated via from_frag_type don't have names –– could be standardized to frag_type_rep_type or something, e.g. decitala_ratio.

Slur articulation note in database creation.

If a frame in rolling search also has a spanner, this should be noted in the database (and in the rolling_search output). The frames with these articulations generally correspond to prosodic feet.

RSR modification detail

It would be nice if in cases of an RSR modification being detected, we could give more precise details about what was subdivided.

Recycle Search

In addition to searching for all matches in a dataset, it would also be nice to be able to explicitly search for a set of fragments. Something like:

rolling_search(
    filepath,
    part_num,
    search_for = [Decitala("Ragavardhana"), GeneralFragment([1.0, 2.0, 3.0], GreekFoot("Trochee")]
)

Pedal part in Livre d'Orgue movement 5

We get that "something is off" error in calculating the ratio. It's likely not related to the fact that there are rests since the other parts are working (seemingly) great and have rests, too...

Histogram of Tala Use

This could be a nice feature for analysis. Return for either a single part or the full piece. Coolest idea: a plt.figure with subplots where each subplot is the histogram of tala use for a part. Note: There should probably be two options: either plot all talas found regardless of the overlapping paradigm, or restrict it to a path.

Feature table

It would be useful to have an additional table created that stores relevant extracted rhythmic information like Valeur Ajoutées and measures that are non-retrogradable.

Unfiltered fragments table

While the filtered Fragments table is normally the table of interest in analysis, for research purposes, it's also useful to have a complete, unfiltered set of extracted fragments.

Search with parameters from logs

Now that we are writing the logs to a file, we can add a parameter to create_database of something like parameters_from_logs which reads the logs and sets the parameters accordingly. If anything other than verbose, write_logs_to_file, and db_path are set, raise an Exception.

UnboundLocalError in trees.py

Was accidentally logging a dictionary that didn't exist in trees.py.
Screen Shot 2021-02-23 at 4 13 20 PM
Replicate with:

create_database(
	db_path = liturgie_path_db,
	filepath = liturgie_path,
	part_num = 4,
	frag_types = ["decitala"],
	allowed_modifications = ["r", "rr", "d", "rd", "rsr"],
	windows = [4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
	filter_found_single_anga_class = True,
	filter_found_sub_fragments = True,
	write_logs_to_file = True,
	verbose = True
)

Weirdly doesn't seem to replicate if part_num=3...

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.