Giter Club home page Giter Club logo

minstrel-mind's Introduction

Minstrel Mind - AI-Powered Music Recommendation for Story-Driven Games

This application utilizes the OpenAI Chat Completion API to recommend and play appropriate songs based on the current state of a story in a game. It reads a configuration file (config.yaml) containing song information and uses the OpenAI API to determine which song should be played given the current story state.

Features

  • Reads song information (filename, tags) from a YAML configuration file
  • Uses the OpenAI Chat Completion API to recommend songs based on the current story state
  • Plays the recommended song using the Pygame mixer library
  • Maintains a conversation history for context-aware song recommendations

Prerequisites

  • Python 3.x
  • OpenAI API key

Installation

  1. Clone the repository:

    git clone https://github.com/DaemonIB/minstrel-mind.git
    
  2. Install the required libraries:

    pip install -r requirements.txt
    
  3. Set up your OpenAI API key:

    • Sign up for an OpenAI account and obtain an API key.
    • Set the environment variable OPENAI_API_URI to your actual API key.
    • Set the environment variable OPENAI_API_KEY to your actual API key.
  4. Create a config.yaml file in the same directory as the script with the following structure:

    songs:
      song1.mp3:
        tags: [tag1, tag2]
      song2.mp3:
        tags: [tag3, tag4]

    Make sure to provide the correct song filenames, tags, and descriptions.

Usage

  1. Run the script:

    python music_recommendation.py
    
  2. Enter the current state of the story when prompted. The script will recommend an appropriate song based on the story state and play it using the Pygame mixer.

  3. To exit the script, enter 'quit' when prompted for the story state.

Configuration

The config.yaml file contains the song information used by the script. Each song entry should have the following structure:

song_filename.mp3:
  tags: [tag1, tag2, ...]
  • song_filename.mp3: The filename of the song file (including the extension).
  • tags: A list of tags associated with the song (optional).

Make sure to update the config.yaml file with your own song information.

All songs in the list must exist in the music folder so that they can be played. The name must verbatim match the yaml.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request.

License

This project is licensed under Apache-2.0.

minstrel-mind's People

Contributors

daemonib avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.