- This repo contains four main Python files:
train_pitch.py
train_duration.py
gen_pitch.py
gen_duration.py
- First, the necessary packages must be installed:
pip install -r requirements.txt
. - Generating melodies from existing pre-trained weights:
- To generate a melody with the Gen-pitch system based on the existing pre-trained weights, run:
python src/gen_pitch.py
. - To generate a melody with the Gen-duration system based on the existing pre-trained weights, run:
python src/gen_duration.py
.
- To generate a melody with the Gen-pitch system based on the existing pre-trained weights, run:
- Training the models:
- To train the Gen-pitch system, run:
python src/train_pitch.py
. A melody can then be generated using the command given above. - To train the Gen-duration system, run:
python src/train_duration.py
. A melody can then be generated using the command given above. - N.B. You will have to change the name of the weights file in
gen_pitch.py
orgen_duration.py
to the filename of the weights you just trained.
- To train the Gen-pitch system, run:
- N.B. The melody files generated by
gen_pitch.py
andgen_duration.py
are MIDI files. In order to listen to them, you can use the EXE file included in the repo, calledMidiPlayer.exe
. This is a small program that facilitates listening to MIDI files. - If you would like to learn more about how these melody generation systems work, please see the report included in this repo.