//Musicgen-Text-to-Musicbyai-tools

Musicgen-Text-to-Music

Turn your words into music! Describe a sound (e.g., happy, spooky) and this app generates a short piece based on your text.

0
0
0

Text to Music Generator 🎵

This repository contains a Streamlit-based web application that generates music from text descriptions using Meta’s Audiocraft library and the MusicGen model.

Features

  • undefinedText Input: Enter a textual description of the type of music you want to generate.
  • undefinedDuration Control: Select the duration of the generated music (up to 20 seconds).
  • undefinedMusic Generation: Generates music based on the provided description and duration.
  • undefinedAudio Playback: Listen to the generated music directly in the browser.

Installation

  1. undefinedClone the repository:

    git clone https://github.com/your-username/text-to-music-generator.git
    cd text-to-music-generator
    
  2. undefinedCreate a virtual environment:

    python3 -m venv music-env
    source music-env/bin/activate
    
  3. undefinedInstall the required packages:

    pip install -r requirements.txt
    

Usage

  1. undefinedRun the Streamlit app:

    streamlit run app.py
    
  2. undefinedOpen your web browser and go to http://localhost:8501 to access the app.

  3. undefinedEnter a description of the type of music you want to generate in the text area.

  4. undefinedSelect the duration of the music using the slider.

  5. undefinedClick “Generate Music” to create and listen to your music.

Screenshot 2024-05-21 at 6 12 32 PM

Example

  1. Enter a description like “80s pop track with bassy drums and synth”.
  2. Select a duration, e.g., 10 seconds.
  3. Click “Generate Music”.
  4. Listen to the generated music.

Requirements

  • streamlit
  • audiocraft
  • torchaudio
  • scipy

Project Structure

  • app.py: The main Streamlit application script.
  • requirements.txt: The dependencies required to run the app.
  • audios/: Directory to save generated audio files.

Contributing

If you have any suggestions or improvements, feel free to open an issue or create a pull request.

License

This project is licensed under the MIT License.

Acknowledgements


Happy music generating! 🎶

[beta]v0.14.0