Coder Social home page Coder Social logo

justinshenk / genre-melodies Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 3.0 14.79 MB

Create genre-specific melodies using Magenta

Home Page: https://justinshenk.github.io/posts/2017/07/deep-genre/

License: MIT License

Python 1.50% Shell 1.26% Jupyter Notebook 96.66% Dockerfile 0.57%
tensorflow lstm-neural-networks music-generation

genre-melodies's Introduction

Deep learning genre-specific melodies with Magenta

Getting Started

This docker installation of a minimal jazz melody generation implementation which runs all of the scripts and begins generating:

docker run -it -p 6006:6006 -v /tmp/magenta:/genre-melodies justinshenk/melodic

Manual Magenta installation:

sudo apt-get update -y
sudo apt-get install libasound2-dev libasound-dev libjack-dev git -y
curl https://raw.githubusercontent.com/tensorflow/magenta/master/magenta/tools/magenta-install.sh > /tmp/magenta-install.sh &&
bash /tmp/magenta-install.sh

or using Conda (NOTE: Magenta currently supports version 2 of Python):

conda create -n magenta python=2.7 jupyter
source activate magenta

Open a new terminal window so the environmental variable changes take effect and enter:

source activate magenta && pip install tensorflow-gpu &&
git clone https://github.com/JustinShenk/genre-melodies.git &&
cd genre-melodies &&
pip install -r requirements.txt &&
python create_dataset.py &&
sh train_model.sh

If using a CPU replace 'tensorflow-gpu' with 'tensorflow'.

Preprocessing and Analysis

See the preprocessing and visualization notebook for sample outputs and visualization scripts.

Visualizations:

2d visualization

3d visualization

Tensorboard graph of trained network:

Tensorboard Graph

Postprocessing

Convert MIDIs to MP3 using timidity.

Install timidity with brew install timidity (OSX) or sudo apt-get install timidity (Ubuntu).

To play the sounds in a browser, convert the files to a format supported by HTML5, such as mp3. Find the generated MIDI files in /tmp/melody_rnn/generated/[genre]. Use a one-line shell command to convert MIDI files to mp3:

$ for file in *.mid ; do timidity "${file}" -Ow -o - | ffmpeg -i - -acodec libmp3lame -ab 64k "${file%.*}.mp3"; done

Output

Check out some samples with an explanation of Magenta's hyperparameters.

genre-melodies's People

Contributors

justinshenk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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