musiclang


Namemusiclang JSON
Version 0.25.0 PyPI version JSON
download
home_page
SummaryA python package for music notation and generation
upload_time2024-02-22 10:18:55
maintainer
docs_urlNone
authorFlorian GARDIN
requires_python>=3.6
licenseBSD 2-Clause License Copyright (c) 2023, Florian GARDIN Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords music ai notation
VCS
bugtrack_url
requirements lxml mido music21 numpy pandas scipy tensorflow toml tomli xmlschema partitura music21 miditok
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Musiclang
=========

![MusicLang logo](https://github.com/MusicLang/musiclang/blob/main/documentation/images/MusicLang.png?raw=true "MusicLang")


[![Documentation Status](https://readthedocs.org/projects/musiclang/badge/?version=latest)](https://musiclang.readthedocs.io/en/latest/?badge=latest)

The Python framework to write, analyze, transform and predict music.


What is MusicLang ?
--------------------

MusicLang which simply stands for "music language" is a Python framework
implementing a new language for tonal music.
This language allows composers to load, write, transform and predict symbolic music in a simple,
condensed and high level manner.

MusicLang internally uses a [LLM (Large Language Model)](https://huggingface.co/floriangardin/musiclang)  to predict what could happen next in a musical score.
/!\ Please note that : we decoupled AI from the language itself in a new package called musiclang_predict. If you want to use AI capabilities of musiclang please install [musiclang_predict](https://github.com/MusicLang/musiclang_predict) package.

This framework is well suited to :
- Generate musical ideas quickly.
- Do symbolic music prediction or inpainting.
- Create an interpretable and rich text representation of a midi file


[Read our documentation](https://musiclang.readthedocs.io/en/latest).


How to install
--------------

MusicLang is available on Pypi :

```
pip install musiclang
```
    

Examples
---------

1. A hello world example to create a C-major chord in musiclang and save it to midi :

```python
from musiclang.library import *

# Write a C major chord (First degree of C major scale)
score = (I % I.M)(piano=[s0, s2, s4])

# Store it to midi
score.to_midi('c_major.mid')
```

2. Create, transform and harmonize a theme quickly : 

```python
from musiclang.library import *

# Create a cool melody (the beginning of happy birthday, independant of any harmonic context)
melody = s4.ed + s4.s + s5 + s4 + s0.o(1) + s6.h

# Create a simple accompaniment with a cello and a oboe
acc_melody = r + s0.o(-1).q * 3 + s0.o(-1).h
accomp = {'cello__0': acc_melody, 'oboe__0': acc_melody.o(1)}

# Play it in F-major
score = (I % IV.M)(violin__0=melody, **accomp)

# Repeat the score a second time in F-minor and forte
score += (score % I.m).f

# Just to create an anachrusis at the first bar
score = (I % I.M)(violin__0=r.h) + score

# Transform a bit the accompaniment by applying counterpoint rules automatically
score = score.get_counterpoint(fixed_parts=['violin__0'])

# Save it to musicxml
score.to_musicxml('happy_birthday.musicxml', signature=(3, 4), title='Happy birthday !')

# Et voilĂ  !
```
![Happy birthday score](https://github.com/MusicLang/musiclang/blob/main/documentation/images/happy_birthday.png?raw=true "Happy Birthday")


3. Predict a score using a deep learning model trained on musiclang language :

See [MusicLang Predict](https://github.com/MusicLang/musiclang_predict) for more information.



Contact us
----------

If you want to help shape the future of open source music generation / language modeling,
please contact [us](mailto:fgardin.pro@gmail.com)

License
-------

The MusicLang base language (this package) is licensed under the BSD 3-Clause License.
The MusicLang predict package and its associated models is licensed under the GPL-3.0 License.



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "musiclang",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "music,ai,notation",
    "author": "Florian GARDIN",
    "author_email": "Florian GARDIN <fgardin.pro@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/96/8c/b64f5a7c9856e58e867af286ffabad5d778fdbf25c5f0c7f927c4b33a487/musiclang-0.25.0.tar.gz",
    "platform": null,
    "description": "Musiclang\n=========\n\n![MusicLang logo](https://github.com/MusicLang/musiclang/blob/main/documentation/images/MusicLang.png?raw=true \"MusicLang\")\n\n\n[![Documentation Status](https://readthedocs.org/projects/musiclang/badge/?version=latest)](https://musiclang.readthedocs.io/en/latest/?badge=latest)\n\nThe Python framework to write, analyze, transform and predict music.\n\n\nWhat is MusicLang ?\n--------------------\n\nMusicLang which simply stands for \"music language\" is a Python framework\nimplementing a new language for tonal music.\nThis language allows composers to load, write, transform and predict symbolic music in a simple,\ncondensed and high level manner.\n\nMusicLang internally uses a [LLM (Large Language Model)](https://huggingface.co/floriangardin/musiclang)  to predict what could happen next in a musical score.\n/!\\ Please note that : we decoupled AI from the language itself in a new package called musiclang_predict. If you want to use AI capabilities of musiclang please install [musiclang_predict](https://github.com/MusicLang/musiclang_predict) package.\n\nThis framework is well suited to :\n- Generate musical ideas quickly.\n- Do symbolic music prediction or inpainting.\n- Create an interpretable and rich text representation of a midi file\n\n\n[Read our documentation](https://musiclang.readthedocs.io/en/latest).\n\n\nHow to install\n--------------\n\nMusicLang is available on Pypi :\n\n```\npip install musiclang\n```\n    \n\nExamples\n---------\n\n1. A hello world example to create a C-major chord in musiclang and save it to midi :\n\n```python\nfrom musiclang.library import *\n\n# Write a C major chord (First degree of C major scale)\nscore = (I % I.M)(piano=[s0, s2, s4])\n\n# Store it to midi\nscore.to_midi('c_major.mid')\n```\n\n2. Create, transform and harmonize a theme quickly : \n\n```python\nfrom musiclang.library import *\n\n# Create a cool melody (the beginning of happy birthday, independant of any harmonic context)\nmelody = s4.ed + s4.s + s5 + s4 + s0.o(1) + s6.h\n\n# Create a simple accompaniment with a cello and a oboe\nacc_melody = r + s0.o(-1).q * 3 + s0.o(-1).h\naccomp = {'cello__0': acc_melody, 'oboe__0': acc_melody.o(1)}\n\n# Play it in F-major\nscore = (I % IV.M)(violin__0=melody, **accomp)\n\n# Repeat the score a second time in F-minor and forte\nscore += (score % I.m).f\n\n# Just to create an anachrusis at the first bar\nscore = (I % I.M)(violin__0=r.h) + score\n\n# Transform a bit the accompaniment by applying counterpoint rules automatically\nscore = score.get_counterpoint(fixed_parts=['violin__0'])\n\n# Save it to musicxml\nscore.to_musicxml('happy_birthday.musicxml', signature=(3, 4), title='Happy birthday !')\n\n# Et voil\u00e0 !\n```\n![Happy birthday score](https://github.com/MusicLang/musiclang/blob/main/documentation/images/happy_birthday.png?raw=true \"Happy Birthday\")\n\n\n3. Predict a score using a deep learning model trained on musiclang language :\n\nSee [MusicLang Predict](https://github.com/MusicLang/musiclang_predict) for more information.\n\n\n\nContact us\n----------\n\nIf you want to help shape the future of open source music generation / language modeling,\nplease contact [us](mailto:fgardin.pro@gmail.com)\n\nLicense\n-------\n\nThe MusicLang base language (this package) is licensed under the BSD 3-Clause License.\nThe MusicLang predict package and its associated models is licensed under the GPL-3.0 License.\n\n\n",
    "bugtrack_url": null,
    "license": "BSD 2-Clause License  Copyright (c) 2023, Florian GARDIN  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.",
    "summary": "A python package for music notation and generation",
    "version": "0.25.0",
    "project_urls": {
        "Homepage": "https://github.com/MusicLang/musiclang"
    },
    "split_keywords": [
        "music",
        "ai",
        "notation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "14d53274f7297785b797d9571b99b20df8e838bae042f208aee910ec1798ea70",
                "md5": "57ed53313f45c754898854003e3fc768",
                "sha256": "24af2739549555f80971325cb67f4542de61c114edb9ae461a77b0efafed9b85"
            },
            "downloads": -1,
            "filename": "musiclang-0.25.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "57ed53313f45c754898854003e3fc768",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 231456,
            "upload_time": "2024-02-22T10:18:53",
            "upload_time_iso_8601": "2024-02-22T10:18:53.420896Z",
            "url": "https://files.pythonhosted.org/packages/14/d5/3274f7297785b797d9571b99b20df8e838bae042f208aee910ec1798ea70/musiclang-0.25.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "968cb64f5a7c9856e58e867af286ffabad5d778fdbf25c5f0c7f927c4b33a487",
                "md5": "49b8d3dc0253a940419048a3b28a2361",
                "sha256": "861d257822b611171acf603e1f35e42fdc2c77bebdbb2e3a1705d32b34255df8"
            },
            "downloads": -1,
            "filename": "musiclang-0.25.0.tar.gz",
            "has_sig": false,
            "md5_digest": "49b8d3dc0253a940419048a3b28a2361",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 182573,
            "upload_time": "2024-02-22T10:18:55",
            "upload_time_iso_8601": "2024-02-22T10:18:55.085693Z",
            "url": "https://files.pythonhosted.org/packages/96/8c/b64f5a7c9856e58e867af286ffabad5d778fdbf25c5f0c7f927c4b33a487/musiclang-0.25.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-22 10:18:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MusicLang",
    "github_project": "musiclang",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "circle": true,
    "requirements": [
        {
            "name": "lxml",
            "specs": []
        },
        {
            "name": "mido",
            "specs": [
                [
                    "==",
                    "1.2.10"
                ]
            ]
        },
        {
            "name": "music21",
            "specs": [
                [
                    "==",
                    "8.1.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "==",
                    "1.5.3"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": []
        },
        {
            "name": "tensorflow",
            "specs": []
        },
        {
            "name": "toml",
            "specs": [
                [
                    "==",
                    "0.10.2"
                ]
            ]
        },
        {
            "name": "tomli",
            "specs": [
                [
                    "==",
                    "2.0.1"
                ]
            ]
        },
        {
            "name": "xmlschema",
            "specs": [
                [
                    "==",
                    "2.1.1"
                ]
            ]
        },
        {
            "name": "partitura",
            "specs": [
                [
                    "==",
                    "1.3.1"
                ]
            ]
        },
        {
            "name": "music21",
            "specs": []
        },
        {
            "name": "miditok",
            "specs": [
                [
                    "==",
                    "2.1.8"
                ]
            ]
        }
    ],
    "lcname": "musiclang"
}
        
Elapsed time: 0.20033s