Skip to content

A model to generate musical harmonies given a melody.

Notifications You must be signed in to change notification settings

jvonhacht/BachNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BachNet

The project involved training a model that is capable of generating harmonies given amelody. The final model employed a sequence-to-sequence structure where each harmony gets generated by separate GRU encoders and decoders before being combined with a fully connected output layer. This model managed to generate harmonies that closely resemble human-created arrangements regardless of thekey in which the melody is played, largely due to the employed data augmentation strategy. However, even though Bach’s chorales were used as training data, the generated compositions do not, necessarily, sound reminiscent of the composer’s work as they employ more modern syncopated rhythms. This is due to the one-hot encoding that was used, showing that special care should be taken when designing the numerical representation of music.

Project presentation: https://www.youtube.com/watch?v=A2kqa82fEEg

Authors

  • Johan von Hacht (JohanKJIP)
  • David Johansson (sofoda)
  • David Stevens (stevensdavid)

How to run

  • Download the data from www.github.com/czhuang/JSB-Chorales-dataset and place the file Jsb16thSeparated.npz inside trainer/data.
  • pip3 install -r requirements.txt
  • To train, run task.py: python3 -m trainer/task.py.
  • To generate melodies run: python3 -m trainer/performer.py. Inside the main function within the file, there is the option to change the melody to generate harmonies for.