Giter Club home page Giter Club logo

music-generation's Introduction

music-generation

Algorithmic music generation using RNN(Recurrent Neural Networks)

Language used : Python 3.5

The following packages have to be installed before running this code:

  1. Keras version 0.1.0 with Theano as the backend.
  2. NumPy and SciPy for various mathematical computation on tensors.
  3. Matplotlib for visualizing the input.
  4. LAME and SoX to convert mp3 files into other formats such as wav.

Step 1: Converting the given mp3 files into np tensors

Type the following command into the terminal:

python convert_directory.py

This converts mp3 into mono files and then into WAV file, which is stored in the form of np-tensors. These np-tensors are given as input to our LSTM model. By the end of this one can find these 2 files generated "YourMusicLibraryNP_x.npy", "YourMusicLibraryNP_y.npy". "YourMusicLibraryNP_x.npy" contains the input sequence for training and "YourMusicLibraryNP_y.npy" contains the same sequence as that of input sequence but shifted by one block.

Step 2: Training the model

Type the following command into the terminal:

python train.py

This builds a LSTM model that generates a sequence of notes which is compared against the expected output and the errors are back-propagated, thus adjusting the parameters learnt by the LSTM. You can change the number of Iterations, number of epochs per iteration and batch size by adjusting the following parameters "num_iters", "epochs_per_iter", "batch_size" respectively in train.py.

Step 3: Generating the music

Now that you've finished training the model, its time to generate some music:) Type the following command in your terminal':

python generate.py

The generated WAV file is stored in a file named generated_song.wav.

You can further read about the entire procedure involved in generating the music, in the following post that is there on this repository, Blog_Post_Music_Gen_1.md.

music-generation's People

Contributors

ani2796 avatar chandanant avatar nischalhp avatar padmajavb avatar raghothams avatar subramaniam97 avatar

Watchers

 avatar  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.