HarmoniX1
HarmoniX is an automatic harmonizer for monophonic melodies.
Simply provide it with a .wav file of a tune, and it will spit
out a new .wav file of the audi in perfect four-part harmony.
HarmoniX consists of three main components:
- Pitch detection using the YIN algorithm2.
- Melody-to-chord generation using a bidirectional LSTM3.
- Pitch shifting using a digital phase vocoder4.
See HarmoniX.ipynb for the code and more details.
First, install the dependencies using the following commands:
python3.11 -m venv env
source env/bin/activate
pip install -r requirements.txt
Then go to HarmoniX.ipynb and run all the cells. By default, the code does not save the trained PyTorch model. However, you can uncomment the commented-out code block to save your own model if you decide to change any hyperparameters.
See examples.ipynb
Footnotes
-
Pronounced "harmonic". The "X" is an uppercase Greek chi. ↩
-
http://recherche.ircam.fr/equipes/pcm/cheveign/ps/2002_JASA_YIN_proof.pdf ↩