Ghadjeres / DeepBach

code accompanying "DeepBach: a Steerable Model for Bach Chorales Generation" paper
MIT License
500 stars 131 forks source link

Trouble Using the Musescore Plugin #56

Closed Nico-Adamo closed 5 years ago

Nico-Adamo commented 5 years ago

I'm on windows 10. After much fiddling, I've gotten DeepBach installed (yay!) and have been able to compose very well by running deepbach.py. However, I'm now trying to use the musescore plugin to get interactive composition.

I've moved the deepBachMuseScore plugin file to my MuseScore plugin directory, and that allows it to load well, but there's no models to choose from, and no matter what I put in for the server adress, none will load. I have models in my DeepBach folder, but that's in a completely separate place from my Musescore plugin files. But just putting a model file into the musescore plugin folder doesn't work either, no matter what I put in for the "server address" (http://localhost:5000/, a direct path to the directory of the model, etc).

How do I load a model into musescore?

EDIT: Alright, I've done some more work and determined I need to set it up with flask to use the musescore plugin. But the flask plugin is only available in the original_keras branch of the git and not in the master version - furthermore, it's not compatible with the current data_utils.py.

Am I missing something, or is the master branch not set up to work as a flask app and therefore to use with musescore?

Ghadjeres commented 5 years ago

Hi! Yes, indeed, I did not include the flask_server for musescore in the pytorch version; and I don't plan to do so. The reason is that we developed a new interface in order to replace musescore, which allows for more intuitive and responsive controls as can be seen here: https://twitter.com/gaetan_hadjeres/status/1086175891896569857 (The MuseScore interface is indeed a bit restrictive). I'm trying to release this interface as soon as possible.

In the meantime, if you really want to use DeepBach with Musescore, I just pushed the Flask server I use with the new interface (flask_server.py). With this file, it should be easy to adapt the old plugin_flask_server.py to use the new implementation. Sorry for that.

Nico-Adamo commented 5 years ago

Thank you so much! I'm looking forward to the new interface. However, I haven't really worked with flask, and I'm having some trouble. The new flask_server seems to make no reference whatsoever to models, which the musescore plugin depends heavily on. Furthermore, load_models no longer exists. Where, then, should I route a GET for models? Or will I have to re-write the musescore plugin too?

In any case, it isn't a big deal - I'll just look for that interface! Hoping it's going to be open source, or at least free?

Ghadjeres commented 5 years ago

Ok, finally I rewrote the musescore_flask_plugin. Unfortunately, some things have changed since the latest version.

Now, I cannot retrieve in python the score displayed in MuseScore. So what I did is to keep a local copy of the generated scores in the flask server. However, if you do so, you are not able to change some parts of the score by hand and to regenerate the other parts with DeepBach.

So far, you just have to start the Flask server, then start the MuseScore plugin and click on compose. The first time you click on compose, a totally new score is generated. Then you can select any region and click on compose.

It works fine in this setting, but:

Also, I just saw today that MuseScore 3 existed. But this plugin, in its current state, is incompatible with it. So for the moment it's only MuseScore 2.

Check musescore_flask_server.py --help if you want to generate

I really hope you will use that!

antoniodimartino commented 4 years ago

Hi, Ghadjeres, I'm trying to install on musescore 2, win10. When I run "python musescore_flask_server.py" the system answers: C:\Program Files\MuseScore 2\plugins\DeepBach-master>python musescore_flask_server.py Traceback (most recent call last): File "musescore_flask_server.py", line 4, in import click ModuleNotFoundError: No module named 'click'

can you help me? thanks

antoniodimartino commented 4 years ago

Maybe for me It would be helpful reading a step-to-step guide....