Skip to content

sonofthomp/midi-harmonizer

Repository files navigation

MIDIHarm - a PSOLA-based MIDI vocal harmonizer

Python tool for pitch-shifting MP3 files to MIDI files.

Usage

  1. Clone the GitHub repo to your computer with git clone https://github.com/sonofthomp/midi-harmonizer.git. Run cd midi-harmonizer to enter the directory.
  2. Install the package requirements with pip install -r requirements.txt
  3. The harmonization happens in two steps. First, generate a "tone file" -- this will be an MP3 file which you should use a guide to sing the melody of the song to. You can generate this with: python3 gen_tone.py <path to MIDI file, should end with .mid> <path you want the tone outputted to, should end with .mp3>
  4. Record yourself singing along to the "tone file" generated from the MIDI file. Store this in a file somewhere on your computer and take note of its location.
  5. From the same directory as the cloned repo, run python3 gen_harmonies.py <path to MIDI file, should end with .mid> <path to you singing, should end with .mp3> <path you want the pitch-corrected version outputed to, should end with .mp3>

Samples:

How Does This Work?

The algorithm used for pitch-shifting is called PSOLA, specifically Max Morrison's Python implementation of it. The program first reads a MIDI file and extracts the note times from it, then groups these into separate vocal tracks, and then pitch-corrects the MP3 file to each track using the PSOLA library. These harmonized tracks are then summed and the result is outputted to an MP3 file.

About

PSOLA-based vocal harmonizer for MIDI files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published