Musiclang
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) 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 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
How to install
MusicLang is available on Pypi :
pip install musiclang
Examples
- A hello world example to create a C-major chord in musiclang and save it to midi :
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')
- Create, transform and harmonize a theme quickly :
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à !
- Predict a score using a deep learning model trained on musiclang language :
See 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
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.
Metadata
Release files for musiclang 0.26.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| musiclang-0.26.0.tar.gz | 182.6 kB | Without provenance | Details for musiclang-0.26.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| musiclang-0.26.0-py3-none-any.whl | Python 3 | none | any | Details for musiclang-0.26.0-py3-none-any.whl |
Total release size: 414.1 kB
Release files / musiclang-0.26.0.tar.gz
| Download URL | musiclang-0.26.0.tar.gz |
|---|---|
| Size | 182.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7e6a9b84d6070ff24865ddc5b2190128f84808f349629fa4a4ba5dedbb48855
|
|
BLAKE2b-256 checksum How to use checksums |
eb4e6cc40782a3a06137cd0524c0d62f1437552cd6ff4b86465416ea07ffdd97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.18
|
Release files / musiclang-0.26.0-py3-none-any.whl
| Download URL | musiclang-0.26.0-py3-none-any.whl |
|---|---|
| Size | 231.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
998894ed0f3268112eaa008d3f31053033dd0f60ef0a573e8ad6ac3c2fd7cada
|
|
BLAKE2b-256 checksum How to use checksums |
7bb4fdc2a4c5b093af3956679150aba31b33803cb75390949152de385cd96ade
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.8.18
|
Security for musiclang 0.26.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.