Skip to content
A python tool to invert the tonality (a.k.a negative harmony) of midi notation
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea initial commit Feb 21, 2018
midi_files refactored a bit Feb 21, 2018
.gitignore added arguments Mar 29, 2018
.gitmodules refactored a bit Feb 21, 2018 updated readme Feb 12, 2019 Update Sep 12, 2019


NegativeHarmonizer is a simple python program to invert the tonality of a music file. This works very well for compositions like Bach's fugues. If you try it on popular music, you'll probably need to transpose the instruments back into their proper ranges, as the bass will be on the top. Beyond the fun of negative-harmonizing songs you know, this is a useful tool for composers and producers to add variations to their work.


  • Python 3
  • mido
    • pip install mido


python midifile.mid --tonic 60 --ignore 9 --adjust-octaves

This example command

  1. creates a new midifile named midifile_negative.mid
  2. flipped over middle C (midi note number 60)
  3. channel 9 is unaltered because we don't want to change the drums.
  4. the tracks are transposed to be close to their original octave, so the bass guitar will stay in the bass range etc.

You can hear more examples of what can be done with NegativeHarmonizer on my YouTube channel (with some neat Tonnetz Lattice visualizations):

Beethoven, Symphony 5, 1st movement: Negative Harmony

Some background on Negative Harmony from Jacob Collier:

Real-time MIDI plug-in for DAWs

You can find the plug-in version here:

You can’t perform that action at this time.