A neural harmony generator that generates four-part (SATB) harmonies from soprano melodies using a seq2seq LSTM architecture with attention mechanism (trained on JSB dataset - based on Bach's chorales).
- Python dependencies: torch, numpy, matplotlib, mido
- GPU: optional (CPU training supported but slower)
- Dataset can be found at https://github.com/czhuang/JSB-Chorales-dataset
- Download and unzip Jsb16thSeparated.json
- Ensure the json file is in the same directory as the code file (harmony_generation_main.py)
Clone repository to your own machine
- Run main harmony generation model -> harmony_generation_main.py
- harmony_generation_main.py - main traning script
- HarmonyGeneration_Report.docx - report about the project
- Also contains training_curves.png, sample_temp.png (6 files - temperature 0.7 and temperature 1.0) and generated_sample_*.mid (3 files) generated from training
harmony_generation_main.py— main training scriptHarmonyGeneration_Report.docx— project report- Also contains:
training_curves.png— plot of training and validation performancesample_temp_0.7_*.png— generated output samples at temperature = 0.7 (3 files)sample_temp_1.0_*.png— generated output samples at temperature = 1.0 (3 files)generated_sample_*.mid— MIDI files generated from training (3 files)