The Composer's Quill: Weaving Melodies using text prompts with MusicGen
Step by Step Guide to generate music in Google Colab
1. Go to https://github.com/camenduru/MusicGen-colab
Do star his repo !!!
2. Scroll down to reach the colab notebooks
3. Choose any colab notebook and click on “Open in Colab”.
(You will need gmail ID to use colab.)
4. Loading … This may take awhile.
5. The magical colab notebook with just 5 lines !!! Click on the arrow.
6. You will get a warning message - Click “Run anyway”.
7. The commands in the cell will get executed - the git repo will be cloned and the required libraries will get installed This step could take a while, even with the notebook having a setting of GPU by default.
8. Ignore the error in red and click on the gradio live link.
9. The Music Generation playground !!!
No amount of exclamations can tell how exciting it is to be able to create music with text especially for a plebian !
10. Add your music prompt. This was my prompt.
Create a binaural beat composition that promotes concentration and focus for studying. The beats should be calming and soothing, without any loud or jarring noises. Aim for a frequency range that encourages an alert mental state without inducing sleepiness.
Add other details are per your liking
- duration of the composition
- model - melody (works with both text and sample music prompt)
- medium, small and large models (these work only with text prompts)
- an increase in temperature gives more randomness in the output
11. Click on generate to process your text prompt to generate music.
12. The model gives the time it will take to create the music along with the number of steps and %age of completion.
13. Some of the other options to check out -
-
Melody Condition (optional) - To remix mostly
-
Music Sample - Works only with the melody model, To create music similar to a piece of music you like
-
Seed gives the seed of the created music and if you want to create music similar to one you have already created before, the seed number can be added
The author of the repo says -
These parameters, such as top-k, top-p, temperature, and classifier-free guidance, provide different ways to influence the output of a music generation model and strike a balance between creativity, diversity, coherence, and control. The specific values for these parameters can be tuned based on the desired outcome and user preferences.
14. And finally - The generated music result ! You can enjoy listening to your creation in the browser as well as download your creation to your drive as a mp4 file.
15. Trying the melody option to get a different version of the beats I like.
16. The result is not bad, although the original is definitely better. Lots of steps and processing when asked 40 second composition. The option with change in temperature came out pretty good.
“So finally I can compose music”, without knowing how to write musical notes !!
“What a time to be alive !!!”
References :
-
In the words of Dr Károly Zsolnai-Fehér of the youtube channel “Two Minute Papers” - what a time to be alive !!!!
-
The surreal images have been created using Bing Image Creator