aiexperiments-ai-duet/README.md

90 lines
4.1 KiB
Markdown
Raw Normal View History

2016-11-14 21:34:31 +00:00
## A.I. Duet
A piano that responds to you.
2016-11-14 21:34:31 +00:00
## About
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.
2016-11-14 21:34:31 +00:00
[https://aiexperiments.withgoogle.com/ai-duet](https://aiexperiments.withgoogle.com/ai-duet)
2016-11-11 18:52:40 +00:00
This is not an official Google product.
2016-11-11 22:52:11 +00:00
## CREDITS
2020-10-01 04:24:36 +00:00
Built by [Yotam Mann](https://github.com/tambien) with friends on the Magenta and Creative Lab teams at Google . It uses [TensorFlow](https://tensorflow.org), [Tone.js](https://github.com/Tonejs/Tone.js) and open-source tools from the [Magenta](https://magenta.tensorflow.org/) project. Check out more at [A.I. Experiments](https://aiexperiments.withgoogle.com).
2016-11-11 22:52:11 +00:00
## 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 players'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.
2016-11-11 22:52:11 +00:00
## INSTALLATION
2016-11-17 04:40:42 +00:00
A.I. Duet only works with [Python 2.7](https://www.python.org/download/releases/2.7/) and it was tested with Node v6. 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:
2016-11-17 04:40:42 +00:00
```bash
cd server
pip install -r requirements.txt
2016-11-17 04:40:42 +00:00
```
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.
2016-11-11 18:52:40 +00:00
If it _did_ install tensorflow and magenta successfully, you can run the server by typing:
2016-11-11 18:52:40 +00:00
```bash
python server.py
2016-11-11 18:52:40 +00:00
```
Then to build and install the front-end Javascript code, first make sure you have [Node.js](https://nodejs.org) 6 installed. And then install of the dependencies of the project and build the code by typing the following in the terminal:
2016-11-11 18:52:40 +00:00
```bash
cd static
npm install
npm run build
2016-11-11 18:52:40 +00:00
```
You can now play with A.I. Duet at [localhost:8080](http://localhost:8080).
2016-11-11 18:52:40 +00:00
## DOCKER
2016-11-11 18:52:40 +00:00
[Docker](https://www.docker.com/) is an open-source containerization software which simplifies installation across various OSes. It is the simplest method to build and install both the front-end and back-end components. Once you have Docker installed, you can just run:
2016-11-11 18:52:40 +00:00
```bash
$ sudo docker build -t ai-duet .
$ sudo docker run -t -p 8080:8080 ai-duet
2016-11-11 18:52:40 +00:00
```
You can now play with A.I. Duet at [localhost:8080](http://localhost:8080).
## 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.
2016-11-11 18:52:40 +00:00
## PIANO KEYBOARD
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.
## AUDIO SAMPLES
2016-11-11 18:52:40 +00:00
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/)).
2016-11-11 18:52:40 +00:00
## LICENSE
Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
2016-11-14 21:34:31 +00:00
limitations under the License.