Installing and training DeepBach on OS X

Summary: Step-by-step instructions for installing DeepBach with its dependencies with pip including a flask server which turns DeepBach into a musescore 2 plugin for interactive composition-work, using python 3.

Install git

There are at least two ways to do this:

  1. Use appstore, install Xcode (The current version of Xcode requires OS X 10.12.6 or later). Xcode is a huge package, about 5 GB, the git-part is only a fraction of that, so it might be a waste of diskspace to install Xcode only to get git, but installing from appstore is easy.
  2. Download the latest Git for OS X installer. This works for older versions of OS X and should be faster (less data to download and install).

Install python 3

https://www.python.org/downloads/mac-osx/

Pick the latest Release. Stay away from release candidate versions (they have "rc" in the name) and beta versions ("b"). 3.6.4 was current as of 2018-03-23.

Install Musescore 2

https://musescore.org/en/download/musescore.dmg

Open a terminal

Open the program Terminal.app which resides in the folder Utilities.

install tensorflow and music21

sudo su
pip3 install matplotlib scipy h5py keras mako nose setuptools tqdm werkzeug \
 wheel pylzma appdirs flask click packaging music21
pip3 install -Iv tensorflow==1.5

Configure music21

python3

Then run this code in the interactive python 3 environment:

import music21
us=music21.environment.UserSettings()
us['musicxmlPath']='/Applications/MuseScore 2.app'
exit()

Set up the target folder for DeepBach

Create a new directory, and make it the current directory

mkdir ~/src
cd ~/src

Clone DeepBach

git clone https://github.com/Ghadjeres/DeepBach.git

Configure Musescore 2

cp ~/src/DeepBach/deepBachMuseScore.qml ~/Documents/MuseScore2/Plugins
model_name = 'deepbach'
# model_name = 'skip_new'

Copy some pre-trained models

[ more to write here]

Start Musescore 2

On OS X you have to manually start Musescore 2 before you run DeepBach, if you want the generated choral to automatically show up in Musescore 2.

Generate a choral

[ more to write here]

Start the flask-server

cd ~/src/DeepBach/DeepBach
export FLASK_APP=~/src/DeepBach/plugin_flask_server.py
python3 -m flask run --host=0.0.0.0

comments powered by Disqus


Back to the index

Blog roll

R-bloggers, Debian Weekly
Valid XHTML 1.0 Strict [Valid RSS] Valid CSS! Emacs Muse Last modified: maj 4, 2018