music-embedding


Namemusic-embedding JSON
Version 1.1.2 PyPI version JSON
download
home_pagehttps://github.com/PooyaHekmati
SummaryA package for representing music data based on music theory
upload_time2024-01-26 23:56:40
maintainer
docs_urlNone
authorPooya Hekmati
requires_python>=3.10
licenseMIT
keywords music interval pianoroll embedding knowledge representation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            Music Embedding
===============

[![Travis CI](https://www.travis-ci.com/PooyaHekmati/music_embedding.svg?branch=main)](https://www.travis-ci.com/github/PooyaHekmati/music_embedding)
[![Codecov](https://img.shields.io/codecov/c/github/PooyaHekmati/music_embedding)](https://codecov.io/gh/PooyaHekmati/music_embedding)
[![GitHub license](https://img.shields.io/github/license/PooyaHekmati/music_embedding)](https://github.com/PooyaHekmati/music_embedding/blob/main/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/PooyaHekmati/music_embedding?include_prereleases)](https://github.com/PooyaHekmati/music_embedding/releases)
[![GitHub Stars](https://img.shields.io/github/stars/pooyahekmati/music_embedding)](https://github.com/PooyaHekmati/music_embedding/stargazers)
![Repo Size](https://img.shields.io/github/repo-size/pooyahekmati/music_embedding)
![Code Size](https://img.shields.io/github/languages/code-size/pooyahekmati/music_embedding)
[![Code Quality](https://img.shields.io/codefactor/grade/github/pooyahekmati/music_embedding)](https://www.codefactor.io/repository/github/pooyahekmati/music_embedding/overview/main)

By Pooya Hekmati 2021-24

Music Embedding is an open source python package for representing music data based on music theory. It provides tools to convert melodic and harmonic sequences to and from pianorolls.

Features
--------

- Representation of music intervals
- Create a sequence of (harmonic or melodic) intervals from pianoroll presentation
- Create pianoroll from a sequence of (harmonic or melodic) intervals
- Break the sequence of intervals into smaller pieces e.g. bars
- Compress the sequence of intervals using Run Length Encoding (RLE)

Why Music Embedding
-------------------
Embedding is an underexplored area in the intersection of AI and music. While many works try to apply NLP-based embedding and automatic embedding (such as convolution), representing music data based on music theory is important. Music Embedding package aims to make employment of music theory easy to enhance the computationals music projects' results. Some potential use cases are:
- Statistical and probabilistic analysis of music pieces,
- Developing generative models to have AI-synthesized music,
- Genre classification,
- Mood recognition,
- Melody extraction,
- Audio-to-Score alignment,
- Score structure analysis.

Installation
------------

Music Embedding's only prerequisite is the Numpy package. Music Embedding is developed and tested in interaction with [Pypianoroll](https://github.com/salu133445/pypianoroll); yet, any other code which can handle pianorolls should work just fine.

To install Music Embedding, please run `pip install music_embedding`. To build Music Embedding from source, please download the [source](https://github.com/PooyaHekmati/music_embedding/releases) and run `python setup.py install`.

Semantic Versioning Policy
--------------------------

Music Embedding uses the x.y.z format to indicate the version where x is the major version number, y is the minor version number, and z is the patch number.

Documentation
-------------

Documentation is available [here](https://pooyahekmati.github.io/music_embedding) and as docstrings with the code.

Citing
------

Please cite [this paper](https://arxiv.org/abs/2104.11880) if you use Music Embedding in a published work.

Usage
-----
Please visit the [Getting Started](https://pooyahekmati.github.io/music_embedding/getting_started.html) page.

The following code snippet demonstrates how to convert a midi file into a sequence of harmonic intervals.

```python
import music_embedding
import pypianoroll

if __name__ == '__main__':
    #opening midi file using pypianoroll
    midi_path = r'c:\Moonlight Sonata.mid'
    multi_track = pypianoroll.read(midi_path) 
    
    #mergeing midi tracks into a single pianoroll so harmonic intervals can be extracted
    merged_piano_roll = multi_track.blend('max') 
    
    #getting pianoroll of the first track
    pianoroll = multi_track.tracks[0].pianoroll
    
    #creating embedder object from music embedding package
    embedder = music_embedding.embedder.embedder()        
    
    #extracting harmonic intervals
    harmonic_intervals = embedder.get_harmonic_intervals_from_pianoroll(pianoroll=pianoroll, ref_pianoroll=merged_piano_roll)
    
    #creating interval object from music embedding package
    interval = music_embedding.interval.interval()
    
    #printing the first 20 intervals
    for i in range(20):
        interval.set_specs_list(harmonic_intervals[i])
        print(interval)
```

Issues
------

If you find a problem, please [file a bug](https://github.com/PooyaHekmati/music_embedding/issues/new).

License
-------

This project is licensed under the MIT License - see the [LICENSE](https://github.com/PooyaHekmati/music_embedding/blob/main/LICENSE) file for details.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/PooyaHekmati",
    "name": "music-embedding",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "",
    "keywords": "music,interval,pianoroll,embedding,knowledge representation",
    "author": "Pooya Hekmati",
    "author_email": "s.pooyahekmati.a@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/71/33/46adcfc8c8e2e23d53937453149a0cf41305ee1d0eb30f0c871db9de1458/music_embedding-1.1.2.tar.gz",
    "platform": null,
    "description": "Music Embedding\n===============\n\n[![Travis CI](https://www.travis-ci.com/PooyaHekmati/music_embedding.svg?branch=main)](https://www.travis-ci.com/github/PooyaHekmati/music_embedding)\n[![Codecov](https://img.shields.io/codecov/c/github/PooyaHekmati/music_embedding)](https://codecov.io/gh/PooyaHekmati/music_embedding)\n[![GitHub license](https://img.shields.io/github/license/PooyaHekmati/music_embedding)](https://github.com/PooyaHekmati/music_embedding/blob/main/LICENSE)\n[![GitHub release](https://img.shields.io/github/v/release/PooyaHekmati/music_embedding?include_prereleases)](https://github.com/PooyaHekmati/music_embedding/releases)\n[![GitHub Stars](https://img.shields.io/github/stars/pooyahekmati/music_embedding)](https://github.com/PooyaHekmati/music_embedding/stargazers)\n![Repo Size](https://img.shields.io/github/repo-size/pooyahekmati/music_embedding)\n![Code Size](https://img.shields.io/github/languages/code-size/pooyahekmati/music_embedding)\n[![Code Quality](https://img.shields.io/codefactor/grade/github/pooyahekmati/music_embedding)](https://www.codefactor.io/repository/github/pooyahekmati/music_embedding/overview/main)\n\nBy Pooya Hekmati 2021-24\n\nMusic Embedding is an open source python package for representing music data based on music theory. It provides tools to convert melodic and harmonic sequences to and from pianorolls.\n\nFeatures\n--------\n\n- Representation of music intervals\n- Create a sequence of (harmonic or melodic) intervals from pianoroll presentation\n- Create pianoroll from a sequence of (harmonic or melodic) intervals\n- Break the sequence of intervals into smaller pieces e.g. bars\n- Compress the sequence of intervals using Run Length Encoding (RLE)\n\nWhy Music Embedding\n-------------------\nEmbedding is an underexplored area in the intersection of AI and music. While many works try to apply NLP-based embedding and automatic embedding (such as convolution), representing music data based on music theory is important. Music Embedding package aims to make employment of music theory easy to enhance the computationals music projects' results. Some potential use cases are:\n- Statistical and probabilistic analysis of music pieces,\n- Developing generative models to have AI-synthesized music,\n- Genre classification,\n- Mood recognition,\n- Melody extraction,\n- Audio-to-Score alignment,\n- Score structure analysis.\n\nInstallation\n------------\n\nMusic Embedding's only prerequisite is the Numpy package. Music Embedding is developed and tested in interaction with [Pypianoroll](https://github.com/salu133445/pypianoroll); yet, any other code which can handle pianorolls should work just fine.\n\nTo install Music Embedding, please run `pip install music_embedding`. To build Music Embedding from source, please download the [source](https://github.com/PooyaHekmati/music_embedding/releases) and run `python setup.py install`.\n\nSemantic Versioning Policy\n--------------------------\n\nMusic Embedding uses the x.y.z format to indicate the version where x is the major version number, y is the minor version number, and z is the patch number.\n\nDocumentation\n-------------\n\nDocumentation is available [here](https://pooyahekmati.github.io/music_embedding) and as docstrings with the code.\n\nCiting\n------\n\nPlease cite [this paper](https://arxiv.org/abs/2104.11880) if you use Music Embedding in a published work.\n\nUsage\n-----\nPlease visit the [Getting Started](https://pooyahekmati.github.io/music_embedding/getting_started.html) page.\n\nThe following code snippet demonstrates how to convert a midi file into a sequence of harmonic intervals.\n\n```python\nimport music_embedding\nimport pypianoroll\n\nif __name__ == '__main__':\n    #opening midi file using pypianoroll\n    midi_path = r'c:\\Moonlight Sonata.mid'\n    multi_track = pypianoroll.read(midi_path) \n    \n    #mergeing midi tracks into a single pianoroll so harmonic intervals can be extracted\n    merged_piano_roll = multi_track.blend('max') \n    \n    #getting pianoroll of the first track\n    pianoroll = multi_track.tracks[0].pianoroll\n    \n    #creating embedder object from music embedding package\n    embedder = music_embedding.embedder.embedder()        \n    \n    #extracting harmonic intervals\n    harmonic_intervals = embedder.get_harmonic_intervals_from_pianoroll(pianoroll=pianoroll, ref_pianoroll=merged_piano_roll)\n    \n    #creating interval object from music embedding package\n    interval = music_embedding.interval.interval()\n    \n    #printing the first 20 intervals\n    for i in range(20):\n        interval.set_specs_list(harmonic_intervals[i])\n        print(interval)\n```\n\nIssues\n------\n\nIf you find a problem, please [file a bug](https://github.com/PooyaHekmati/music_embedding/issues/new).\n\nLicense\n-------\n\nThis project is licensed under the MIT License - see the [LICENSE](https://github.com/PooyaHekmati/music_embedding/blob/main/LICENSE) file for details.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A package for representing music data based on music theory",
    "version": "1.1.2",
    "project_urls": {
        "Documentation": "https://pooyahekmati.github.io/music_embedding/",
        "Download": "https://github.com/PooyaHekmati/music_embedding/archive/v1.1.2.tar.gz",
        "Homepage": "https://github.com/PooyaHekmati"
    },
    "split_keywords": [
        "music",
        "interval",
        "pianoroll",
        "embedding",
        "knowledge representation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "899bee23a73d3f39b5b5866b1bc07e25d1641014cb054ccd14a909cb4c1f31f0",
                "md5": "7d2399d2d485cd0bd02ef35694608c05",
                "sha256": "565a2bbdf73b41ba711d4280e144f5909637dcc4ad3d945dc585b05592c9ec6f"
            },
            "downloads": -1,
            "filename": "music_embedding-1.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7d2399d2d485cd0bd02ef35694608c05",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 15223,
            "upload_time": "2024-01-26T23:56:39",
            "upload_time_iso_8601": "2024-01-26T23:56:39.222743Z",
            "url": "https://files.pythonhosted.org/packages/89/9b/ee23a73d3f39b5b5866b1bc07e25d1641014cb054ccd14a909cb4c1f31f0/music_embedding-1.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "713346adcfc8c8e2e23d53937453149a0cf41305ee1d0eb30f0c871db9de1458",
                "md5": "9410aeee32d10bed5f51fe65a7be3959",
                "sha256": "d1b39c72a9bec6fcc5f1e5edfd4e7bc91435150a0e488ce15b34be8ff45214a5"
            },
            "downloads": -1,
            "filename": "music_embedding-1.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "9410aeee32d10bed5f51fe65a7be3959",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 18531,
            "upload_time": "2024-01-26T23:56:40",
            "upload_time_iso_8601": "2024-01-26T23:56:40.848960Z",
            "url": "https://files.pythonhosted.org/packages/71/33/46adcfc8c8e2e23d53937453149a0cf41305ee1d0eb30f0c871db9de1458/music_embedding-1.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-26 23:56:40",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PooyaHekmati",
    "github_project": "music_embedding",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "music-embedding"
}
        
Elapsed time: 0.20409s