Skip to content

adamwdraper/llm-mixtape

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spotify Mixtape Medley Maker 🎵

A Streamlit application that uses OpenAI's gpt-4o and Spotify's API to create AI-powered mixtapes. The app leverages gpt-4o to intelligently select iconic moments from songs based on your prompts, then uses Spotify's API to create and play personalized medleys of these memorable segments.

How It Works

The app uses OpenAI's gpt-4o model to generate personalized mixtapes:

  1. When you enter a description (e.g., "Create a 5-minute mixtape of classic rock hits from the 70s, focusing on guitar solos"), the app sends this to OpenAI's API.

  2. The AI model generates a structured JSON response containing:

    • Mixtape title
    • Total duration
    • List of songs with:
      • Song name
      • Artist
      • Start timestamp (MM:SS)
      • Stop timestamp (MM:SS)
  3. The AI is specifically instructed to:

    • Choose the most iconic or memorable parts of songs
    • Select segments between 20-60 seconds long
    • Focus on memorable moments like choruses, guitar solos, or hooks
    • Use accurate timestamps where these iconic moments occur
  4. This generated playlist is then used to create a medley by playing the specified segments of each song through Spotify's API.

Features

  • Generate custom mixtapes based on text prompts
  • Seamless integration with Spotify's playback features
  • Real-time playlist creation and management
  • Interactive web interface

Prerequisites

  • Python 3.8 or higher
  • A Spotify Premium account
  • Spotify Developer credentials (Client ID and Client Secret)

Setup Instructions

  1. Clone this repository:

    git clone https://github.com/yourusername/spotify-mixtape.git
    cd spotify-mixtape
  2. Set up a Python virtual environment:

    pyenv virtualenv spotify-mixtape
    pyenv activate spotify-mixtape
  3. Install the required dependencies:

    pip install -r requirements.txt
  4. Create a Spotify Developer Application:

    • Go to Spotify Developer Dashboard
    • Create a new application
    • Note down your Client ID and Client Secret
    • Add http://localhost:8501 to your application's Redirect URIs
  5. Create a .env file in the project root with the following content:

    # Spotify API Credentials
    SPOTIPY_CLIENT_ID=your_client_id_here
    SPOTIPY_CLIENT_SECRET=your_client_secret_here
    SPOTIPY_REDIRECT_URI=http://localhost:8501
    
    # OpenAI API Key for mixtape generation
    OPENAI_API_KEY=your_openai_api_key_here
    
    # Weights & Biases API Key
    WANDB_API_KEY=your_wandb_api_key_here
    

Running the Application

  1. Ensure your virtual environment is activated:

    pyenv activate spotify-mixtape
  2. Start the Streamlit application:

    streamlit run app.py
  3. Open your web browser and navigate to http://localhost:8501

  4. Log in with your Spotify account when prompted

Notes

  • You must have an active Spotify Premium subscription to use playback features
  • Make sure you have a Spotify-compatible device available for playback
  • Keep your .env file secure and never commit it to version control

Troubleshooting

If you encounter any issues:

  1. Ensure all environment variables are properly set
  2. Check that your Spotify Premium subscription is active
  3. Verify that you have an active internet connection
  4. Make sure your Spotify device is available and ready for playback

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages