This repository contains a Streamlit-based web application that generates music from text descriptions using Meta's Audiocraft library and the MusicGen model.
- Text Input: Enter a textual description of the type of music you want to generate.
- Duration Control: Select the duration of the generated music (up to 20 seconds).
- Music Generation: Generates music based on the provided description and duration.
- Audio Playback: Listen to the generated music directly in the browser.
-
Clone the repository:
git clone https://github.com/your-username/text-to-music-generator.git cd text-to-music-generator
-
Create a virtual environment:
python3 -m venv music-env source music-env/bin/activate
-
Install the required packages:
pip install -r requirements.txt
-
Run the Streamlit app:
streamlit run app.py
-
Open your web browser and go to
http://localhost:8501
to access the app. -
Enter a description of the type of music you want to generate in the text area.
-
Select the duration of the music using the slider.
-
Click "Generate Music" to create and listen to your music.
- Enter a description like "80s pop track with bassy drums and synth".
- Select a duration, e.g., 10 seconds.
- Click "Generate Music".
- Listen to the generated music.
streamlit
audiocraft
torchaudio
scipy
app.py
: The main Streamlit application script.requirements.txt
: The dependencies required to run the app.audios/
: Directory to save generated audio files.
If you have any suggestions or improvements, feel free to open an issue or create a pull request.
This project is licensed under the MIT License.
- The app uses Meta's Audiocraft library.
- Special thanks to the developers of the MusicGen model.
Happy music generating! 🎶