Edit model card

MusicLang Chord Predictor model

MusicLang logo

MusicLang Chord Predictor is a model for creating original chord scale progressions in the musiclang format with generative AI model.

It can be used for different use cases :

  • Predict a chord progression from scratch (a fixed number of chords)
  • Continue a chord progression (using a MusicLang prompt)

If you are only looking to generate chord progressions in an easily readable format, consider using our text chord predictor

To make the prediction we have an inference package available here : MusicLang Predict which is based on the musiclang language : MusicLang.

Installation

Install the musiclang-predict package with pip :

pip install musiclang-predict

How to use ?

  1. Generate a 4 chords progression in few lines :
from musiclang_predict import predict_chords, MusicLangTokenizer
from transformers import AutoModelForCausalLM, AutoTokenizer
from musiclang.library import *

# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained('musiclang/musiclang-chord-v2-4k')
tokenizer = AutoTokenizer.from_pretrained('musiclang/musiclang-chord-v2-4k')
soundtrack = predict_chords(model, tokenizer, nb_chords=4, temperature=1.0)

# Give the chord a simple voicing (closed position chord)
soundtrack = soundtrack(b0, b1, b2, b3)

# Save it to midi
soundtrack.to_midi('song.mid', tempo=120, time_signature=(4, 4))
  1. Use a prompt
from musiclang_predict import predict_chords, MusicLangTokenizer
from transformers import AutoModelForCausalLM, AutoTokenizer
from musiclang.library import *

prompt = (I % I.M) + (V % I.M)['6'].o(-1)

# Load model and tokenizer
model = GPT2LMHeadModel.from_pretrained('musiclang/musiclang-chord-v2-4k')
tokenizer = AutoTokenizer.from_pretrained('musiclang/musiclang-chord-v2-4k')
soundtrack = predict_chords(model, tokenizer, nb_chords=4, prompt=prompt)

# Give the chord a simple voicing (closed position chord)
soundtrack = soundtrack(b0, b1, b2, b3)

# Save it to midi
soundtrack.to_midi('song.mid', tempo=120, time_signature=(4, 4))

Contact us

If you want to help shape the future of open source music generation, please contact us

License

This model is free to use for research and open source purpose only. Please credit me (Florian GARDIN) and musiclang if you do so.

If you would like to use this in a commercial product please contact us to discuss licensing terms and potential integration in your product. I am looking forward to hearing about your project !

Downloads last month
88
Safetensors
Model size
5.59M params
Tensor type
F32
·
Inference Examples
This model does not have enough activity to be deployed to Inference API (serverless) yet. Increase its social visibility and check back later, or deploy to Inference Endpoints (dedicated) instead.