CPJKU / accompanion

An expressive accompaniment system for piano performances
Apache License 2.0
10 stars 1 forks source link

Config gui #12

Closed nimrodVarga closed 1 year ago

nimrodVarga commented 2 years ago

_configgui.py has code with which users can set the parameters of the __init__ method of a Python class (at least, for a reasonably large amount anyway, I don't think every class will properly work) specifically for our case the current ACCompanion subclasses HMMACCompanion and OLTWACCompanion.

In order for it to work more reliably, I had to change and add type annotations to the __init__ methods, for example, solo_fn is of type List[str] now, which makes sense because the single file case is covered with that type as well.

Also, a --skip_gui flag was added, since the GUI is intended to be the easiest way to configure the ACCompanion, I thought it is more appropriate to have to explicitly disable the GUI if configuration via command line or yaml files is wanted.

There is also a new dependency now, PySimpleGUI.

The code is still not 100% done. For example, there currently isn't support for Optional types, which would be good though and there already is a post-processing step necessary in _launch_accyaml.py in order to set midi_fn to None if the GUI configuration returns the empty string. But it works for most intents and purposes, I'd say.

The code was made rather generic (which isn't always a good thing) to hopefully accommodate future changes to the ACCompanion API (the code already has a lot of

this is a workaround for now

comments), so the code sadly isn't the simplest and most straightforward, but complexity is still rather on the low end, I'd say.

neosatrapahereje commented 1 year ago

The GUI has been changed to branch clean_gui. I'll close this pull request for now.