Code Monkey home page Code Monkey logo

aicomposer's Introduction

AI Composer

AI Composer is a student project with a simple task: Create an AI using a keras LSTM model that composes new instrumental music.

Our project is divided into three parts:

  • Data processing
  • LSTM model Training
  • Pygame Application / song generation

Requirements

  • python 3.8

Optional:

  • Cuda + cuDNN for GPU training

installation

Run pip install -r requirements.txt

Prepare data

The generator our model uses for training can only process .h5 files. To facilitate this you first need a dataset of midi files. You then need to set up config.py with the correct values.

config values

You can change these values in config.py.

# Where the midi files process_data.py uses are stored
MIDI_FOLDER = your dataset path

# Where to store the files converted by process_data.py
CONVERTED_PATH = your converted dataset path

running

Run process_data.py to start the processing.

Training

We strongly advise training on a GPU, as it greatly accelerates the training speed.

config values

Our training process uses these config values when training.

# Where the trained models are saved
MODELS_FOLDER = your model path

# How many time steps to train on at a time
SEQUENCE_LENGTH = your length

# The batch size to train with
BATCH_SIZE = your batch size

# The training learning rate
LEARNING_RATE = your learning rate

# The number of epochs to train
EPOCHS = your number of epochs

# The number of steps pr epochs
STEPS_PR_EPOCHS = your number of steps pr epochs

# Where to store the files converted by process_data.py
CONVERTED_PATH = your converted files

running

Run training.py to start the training.

The model will be saved to MODELS_FOLDER/model when done. It will also at the end of every epoch save the most accurate model to MODELS_FOLDER/most_accurate and the model with the least loss to MODELS_FOLDER/least_loss.

Test model

Run test_model.py to test the model

You can alter the python file to choose whether to create a new song from scratch or continue from a song in your CONVERTED_PATH dataset.

You can also change the temperature and note frequency of the predicted songs. A higher temperature will mean a more creative and chaotic end song, while a higher note frequency will simply mean more notes.

Results

https://soundcloud.com/espen-fosseide/sets/ai-generated-music?utm_source=clipboard&utm_medium=text&utm_campaign=social_sharing

aicomposer's People

Contributors

espenbfo avatar studbrage avatar tforgaard avatar ulrikisdahl avatar mariivaa avatar sannejamila avatar abasin47 avatar matsellingsen avatar

Stargazers

Sverre Nystad avatar  avatar Kidding avatar Jonathan Jørgensen avatar

Watchers

Jonathan Jørgensen avatar  avatar Håvard avatar

Forkers

ifgcguitarclub

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.