iTranslated by AI
Trying Out Audio Craft with WebUI on Paperspace
Overview of Audio Craft
Audio Craft is a simple framework for generating high-quality, realistic audio and music from text-based user input.
Audio Craft consists of three models: MusicGen, AudioGen, and EnCodec.
In this article, I used "MusicGen" from among them.
MusicGen is trained on specific music and generates music from text-based input.
In other words, you can create music just by typing text.
Overview of MusicGen-colab
MusicGen-colab is a project published on GitHub that allows you to operate MusicGen via a web UI. Think of it as a music version of the Stable Diffusion web UI.
MusicGen-colab is designed to allow adjustment of parameters to generate specific musical styles and characteristics.
While it can be easily configured in Google Colab, I implemented it on Paperspace this time.
This guide assumes you already have a Paperspace account.
Introduction of MusicGen-colab
Creating a Project in Paperspace
First, create a project in Paperspace and select a machine type.
Next, launch a Jupyter notebook and decide on the installation location.
This time, I will install it in the /tmp directory, which allows for temporary storage.
(Similar to Google Colab, it will be deleted once you end the session.)
# Preparing the folder
%mkdir /tmp/MusicGen_colab
%cd /tmp/MusicGen_colab
Cloning MusicGen-colab
Clone the MusicGen-colab project using Git.
%cd /tmp/MusicGen_colab
!git clone -b v1.0 https://github.com/camenduru/audiocraft
Install the dependencies.
# Installing necessary dependencies
%cd /tmp/MusicGen_colab/audiocraft
!pip install -r requirements.txt
MusicGen-colab may depend on specific package versions.
It turned out that installing spacy version 3.5.2 and pydantic version 1.10.12 is necessary on Paperspace.
Using any other versions will result in errors.
(Changing to the same versions as Google Colab.)
# Reinstalling packages
!pip uninstall spacy pydantic -y
!pip install spacy==3.5.2 pydantic==1.10.12
Running the web UI
Finally, execute app.py to start the web UI. If errors occur during this process, you may need to install appropriate dependencies or adjust settings.
# Starting the web UI
!python app.py --share
Click the URL displayed in "Running on public URL:" to launch the web UI.

How to operate the web UI
Entering Text
Input text into "Input Text" and click the submit button to start generation.
If you scroll down the screen, you will see "Examples." Clicking on one of them will insert it into "Input Text" and "Melody Condition."
Song Duration
You can change the length of the song by adjusting the "Duration" setting (in seconds).
Increasing this value will increase the generation time accordingly.
Prompt example
A catchy YouTube BGM loop, playing at a lively 130 BPM, features bright synthesizers, electric guitar, and upbeat drum machine rhythms. The simple and memorable melody creates a positive and engaging backdrop, enhancing the content without overpowering it. Perfect for adding energy and flair to any video.
By including BPM and instruments, it will generate the music as requested.
Conclusion
I was able to try out Audio Craft using the web UI on Paperspace. I hope this article is helpful.
Reference Articles
Discussion