Chorale harmonisation with given soprano melody - key?
Opened this issue · 3 comments
Running this command on a midi file containing a simple melody in C major, using the pre-trained model available on DropBox,
python3 deepBach.py -m midi/file/path.mid -p 16 -i 20000
gives me a harmonisation in A minor. Also if I try other keys like G major the results just sound strange. Is there some way to tell DeepBach what key I want to use? I cannot see this in the options.
Hi,
You are right. There are no options to specify the key metadata when providing a midi file to reharmonize. Sorry about that. There is a todo comment on this specific issue in the code in deepBach.py.
It could be easily implemented by adding a key parameter to the generate method of the Metadata class. However, the metadata need also contain where cadences should be (fermata), but this is hard to be given as a command line argument.
Another way to proceed could be to run an analyser on the provided midi file that would compute all metadata (keys and fermata) for this specific file.
Also, in this implementation I do not distinguish between a major key and its relative key. This can also be changed by adding this Metadata information (there is a ModeMetadata class) but you would need to recompute the models.
In this case how is the key determined by the software?
There is the music21.analysis.floatingKey.KeyAnalyzer which can do that.
I used this in the KeyMetadatas class.
I might add this feature at some point