updating installation instructions for new pip-installable tf and magenta

This commit is contained in:
Yotam Mann 2017-01-13 17:58:12 -05:00
parent 3d53f239f8
commit 4c581eaab8

View File

@ -3,7 +3,7 @@ Trade melodies with a neural network.
## About ## About
This experiment lets you make music through machine learning. A neural network was trained on many examples and it learns about musical concepts, building a map of notes and timings. You just play a few notes, and see how the neural net responds. Were working on putting the experiment on the web so that anyone can play with it. In the meantime, learn about it by watching the video at this link: This experiment lets you make music through machine learning. A neural network was trained on many MIDI examples and it learned about musical concepts, building a map of notes and timings. You just play a few notes, and see how the neural net responds.
[https://aiexperiments.withgoogle.com/ai-duet](https://aiexperiments.withgoogle.com/ai-duet) [https://aiexperiments.withgoogle.com/ai-duet](https://aiexperiments.withgoogle.com/ai-duet)
@ -15,7 +15,36 @@ Built by [Yotam Mann](https://github.com/tambien) with friends on the Magenta an
## OVERVIEW ## OVERVIEW
A.I. Duet is composed of two parts, the front-end which is in the 'static' folder and the back-end which is in the 'server' folder. The front-end client creates short midi files using the user's input which is sent to the server. The server takes that midi input and continues it using [Magenta](https://github.com/tensorflow/magenta) which is then returned back to the client. A.I. Duet is composed of two parts, the front-end which is in the `static` folder and the back-end which is in the `server` folder. The front-end client creates short MIDI files using the user's input which is sent to a [Flask](http://flask.pocoo.org/) server. The server takes that MIDI input and "continues" it using [Magenta](https://github.com/tensorflow/magenta) and [TensorFlow](https://www.tensorflow.org/) which is then returned back to the client.
## INSTALLATION
A.I. Duet only works with [Python 2.7](https://www.python.org/download/releases/2.7/). There are two basic ways of installing A.I. Duet: with Docker or without Docker.
If you already have a Python environment setup, install all of the server dependencies and start the server by typing the following in the terminal:
```bash
cd server
pip install -r requirements.txt
```
If this does not work, jump down to the [Docker](#docker) installation instructions, which will walk you through installing A.I. Duet within a Docker container.
If it _did_ install tensorflow and magenta successfully, you can run the server by typing:
```bash
python server.py
```
Then to build and install the front-end Javascript code, first make sure you have [Node.js](https://nodejs.org) and [webpack](https://webpack.github.io/) installed. And then install of the dependencies of the project and build the code by typing the following in the terminal:
```bash
cd static
npm install
webpack -p
```
You can now play with A.I. Duet at [localhost:8080](http://localhost:8080).
## DOCKER ## DOCKER
@ -28,44 +57,6 @@ $ sudo docker run -t -p 8080:8080 ai-duet
You can now play with A.I. Duet at [localhost:8080](http://localhost:8080). You can now play with A.I. Duet at [localhost:8080](http://localhost:8080).
## FRONT END
If you installed with Docker, the front-end has already been built. To build the client-side javascript outside of Docker, first install [node](https://nodejs.org) and [webpack](https://webpack.github.io/). Then you can install of the dependencies of the project by typing the following in the terminal:
```bash
cd static
npm install
```
Then build all of the files
```bash
webpack -p
```
### BACK END
If you installed with Docker, then these dependencies have already been installed. To build the back-end separately, follow these instructions:
The back-end consists of a [Flask](http://flask.pocoo.org/) server, [TensorFlow](https://www.tensorflow.org/) and [Magenta](https://github.com/tensorflow/magenta).
First install [TensorFlow](https://www.tensorflow.org/versions/master/get_started/os_setup.html) and [Magenta](https://github.com/tensorflow/magenta#installation).
To install the rest of the back-end requirements (make sure you have python and [pip](https://pip.pypa.io/en/stable/installing/) installed):
```bash
cd server
pip2 install -r requirements.txt
```
Then run the server:
```bash
python server.py
```
You can now play with A.I. Duet at [localhost:8080](http://localhost:8080).
## MIDI SUPPORT ## MIDI SUPPORT
The A.I. Duet supports MIDI keyboard input using [Web Midi API](https://webaudio.github.io/web-midi-api/) and the [WebMIDI](https://github.com/cotejp/webmidi) library. Make sure you refresh the page after plugging in a keyboard to make sure it connects correctly. The A.I. Duet supports MIDI keyboard input using [Web Midi API](https://webaudio.github.io/web-midi-api/) and the [WebMIDI](https://github.com/cotejp/webmidi) library. Make sure you refresh the page after plugging in a keyboard to make sure it connects correctly.
@ -74,10 +65,12 @@ The A.I. Duet supports MIDI keyboard input using [Web Midi API](https://webaudio
The piano can also be controlled from your computer keyboard thanks to [Audiokeys](https://github.com/kylestetz/AudioKeys). The center row of the keyboard is the white keys. The piano can also be controlled from your computer keyboard thanks to [Audiokeys](https://github.com/kylestetz/AudioKeys). The center row of the keyboard is the white keys.
## PIANO AUDIO ## AUDIO SAMPLES
Multisampled piano from [Salamander Grand Piano V3](https://archive.org/details/SalamanderGrandPianoV3) by Alexander Holm ([Creative Commons Attribution 3.0](https://creativecommons.org/licenses/by/3.0/)). Multisampled piano from [Salamander Grand Piano V3](https://archive.org/details/SalamanderGrandPianoV3) by Alexander Holm ([Creative Commons Attribution 3.0](https://creativecommons.org/licenses/by/3.0/)).
String sounds from [MIDI.js Soundfonts](https://github.com/gleitz/midi-js-soundfonts) generated from [FluidR3_GM.sf2](http://www.musescore.org/download/fluid-soundfont.tar.gz) ([Creative Commons Attribution 3.0](https://creativecommons.org/licenses/by/3.0/)).
## LICENSE ## LICENSE
Copyright 2016 Google Inc. Copyright 2016 Google Inc.