GithubHelp home page GithubHelp logo

aihero's Introduction

LinkedIn


Logo

AI Hero Server

An Artificial Intelligence built for generating musical melodies

training animation

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Contact
  4. Acknowledgments

About The Project

The AI Hero project proposes a blues melody generator, that tries to emulate the improvisation process of the human mind.

Project Architecture

This work proposes an architecture composed of a genetic algorithm whose initial population is fed by generative adversarial networks (GANs) specialized in generating melodies for certain harmonic functions. The fitness function of the genetic algorithm is a weighted sum of heuristic methods for evaluating quality, where the weights of each function are assigned by the user, before requesting the melody. A data augmentation statregy for the GAN training data was proposed and experimentally validated. This experiment and two others are available in the masters thesis (in portuguese) generated by this work.

Also, this article, validating a data augmentation strategy proposal, was published as a consequence of the work.

(back to top)

Getting Started

Below is the guideline on how to run the python server locally for training or generating melodies

Installation

This project was developed using Python 3.8. So, make sure you are using a compatible version. Then, install the dependencies.

  • Install dependencies

    pip install -r requirements.txt
  • Install dependencies for mac - A different tensorflow needs to be used

    pip install -r requirements-mac.txt

(back to top)

Model Training

To train the Model (GAN), you should go to the src/GEN folder and run the train_script.py. All important configurations are available in src/config.json

(back to top)

Model Execution

To execute the Model as a server, you should run

python src/main.py src/config.json

Then, the server, with loaded models, will be available at port 8083 (this can be modified in the src/config.json).

Requesting a Melody

To actually request a melody, you could clone the front-end project and execute it: Product Name Screen Shot

Alternativelly you could make the REST requests by yourself. Here is how to do it:

Initially you should ask for the melody using a POST request, as follows:

url:

http://localhost:8083/melody?source=${source}

where source can have one of following values: train, gan or evo

body:

{
  harmony_specs:
    [
      { melodic_part: "", chord: "C:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "F:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "C:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "C:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "F:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "F:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "C:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "C:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "G:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "F:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "C:7maj", key: "C", tempo: 120 },
      { melodic_part: "", chord: "G:7maj", key: "C", tempo: 120 },
    ],
  evolutionary_specs:
    [
      {
        key: "notes_on_same_chord_key",
        name: "Notes on Same Chord",
        description: "notes_on_same_chord_key",
        transf_weights: [Array],
        bounds: [Array],
        weight: 0,
      },
      {
        key: "notes_on_beat_rate",
        name: "Notes on Beat",
        description: "notes_on_beat_rate",
        transf_weights: [Array],
        bounds: [Array],
        weight: 0,
      },
      {
        key: "note_on_density",
        name: "Note Density",
        description: "note_on_density",
        transf_weights: [Array],
        bounds: [Array],
        weight: 1,
      },
      {
        key: "note_variety_rate",
        name: "Note Variety",
        description: "note_variety_rate",
        transf_weights: [Array],
        bounds: [Array],
        weight: 0,
      },
      {
        key: "single_notes_rate",
        name: "Single Notes Rate",
        description: "single_notes_rate",
        transf_weights: [Array],
        bounds: [Array],
        weight: 1,
      },
      {
        key: "notes_out_of_scale_rate",
        name: "Notes out of Scale",
        description: "notes_out_of_scale_rate",
        transf_weights: [Array],
        bounds: [Array],
        weight: 0,
      },
    ],
}

You will then receive the melodyId in the response, which will be an MD5 hash (ex: 205f1c3b-da87-455f-94b6-a8f49cb346b9).

Then, you can query for the melody by making a GET request with

localhost:8083/melody/${melodyId}

If the melody is not ready, you will receive a response 404, if it is ready, you will receive a response with status 200 and the .mid file.

(back to top)

Contact

For more clarification, please reach out!

Matheus Bitarães - LinkedIn - [email protected]

Project Link: https://aihero.bitaraes.com.br

(back to top)

Acknowledgments

(back to top)

aihero's People

Contributors

matheusbitaraes avatar matheus-bitaraes-deel avatar

Stargazers

 avatar Aaron L. avatar

Watchers

 avatar

aihero's Issues

Refinar modelo da GAN

  • Revisar algumas tecnicas de redes profundas para ver se melhoro o treinamento da GAN.
  • Marcar reunião com Fred para discutir.

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.