Guide
- Use
git clone --recurse-submodules git@github.com:juyaolongpaul/harmonic_analysis.git, then usecd harmonic_analysisto go into the project folder. Making sure that you are on the master branch. - Create a virtual environment using Python 3. Making sure you have it already installed in your computer, and added to
PATH. Also, making sure you havevirtualenvalready installed. To install it in Windows, please refer here, until “Launch virtualenv” Section since you are going to use the following commands to launch it. In Linux and Mac OS, an example is:virtualenv .env --python=python3. In Windows, usevirtualenv .env --python=python. - Activate the virtual environment. If you use the command line provided in the second step, you can activate it by
source ./.env/bin/activatein Mac OS and Linux; in Windows, it is.\.env\Scripts\activate. - Use
pip install -r requirements_gpu.txtto install the required packages if you have a CUDA-compatiable GPU (you need to download CUDA and cuDNN first and install them) and you want to train the networks on GPU; usepip install -r requirements_cpu.txtif you want to train the networks on CPU. Please make sure your python version is 3.7 or under! Currently, python 3.8 does not work because tensorflow cannot be installed. - Use
python main_FB.pyto run the project with the default parameter, and you should be able to achieve the same results (i.e., the result of DNN) reported in the paper. The generate figured bass (saved as MusicXML files) can be found in the directory:./predicted_result/Bach_o_FB/NCT_pitch_classpitch_class3meter_NewOnsetDNN1_2_rule_3/.One generated result is shown below:
One only needs to observe the last two voices (at the bottom), where the last voice contains the generated figured bass annotations (FBAs) by the rule-based algorithm, and the second last voice contains both ground truth FBAs (upper), and the generated FBAs by machine learning algorithms (lower). Underneath the generated FBAs, there are results, where “✓” means that the generated figured bass exactly matches Bach’s FBAs (the ground truth), “✓_” means they are considered correct by our evaluation metric that treats musically equivalent figures as equivalent (see the paper of Section 3.3.2). “✘” means the generated figures are considered as errors.
If you have questions or further inquiries, please send an email to yaolong.ju@mail.mcgill.ca.