reharm, the chord-swap tool
The first piece you can use on a real track. Give it a loop and the progression you want. It hears the chords that are there, works out the smallest set of note moves, and writes a new WAV in the same format, ready to drop into a session.
reharm loop.wav --bpm 84 --to "Bb Fm Gm Dm" heard Bb F Gm Dm becomes Bb Fm Gm Dm move A4 → Ab4 2.94–5.20s move A3 → Ab3 3.59–5.04s move A3 → Ab3 5.03–5.34s wrote loop - Bb Fm Gm Dm - 84bpm.wav time detect 129 ms · analysis 10 ms · render 47 ms · total 620 ms
What I need from you
- Are these edits you'd keep? Each example below is exactly what the command wrote. Switch between Original and Output while it plays.
- Try it on one of your own loops (setup below). What breaks first: the chords it hears, the notes it chooses to move, or how the result sounds?
Timing (the 200 ms goal)
| Example | Detect (once per file) | Analysis (once) | Re-render per edit |
|---|
Detection and analysis run once when a file is dropped. Only the re-render runs on each chord click in the app, and it stays well under 200 ms, even for a stereo 11-second loop (about 90 ms).
Try it on your own loop
cd ~/Developer/reharmonizer scripts/fetch-models.sh # basic-pitch model, 230 KB cargo build --release -p reharm target/release/reharm my-loop.wav --plan --bpm 90 # what it hears target/release/reharm my-loop.wav --bpm 90 --to "Am F C G" # do it target/release/reharm my-loop.wav --bpm 90 --to "- - - E" # change one bar, keep the rest target/release/reharm my-loop.wav --to "canon://eyJr…" # a progression shared from canon
- Give it the tempo. With
--bpmit reads one chord per bar (set--beats-per-chordfor other lengths,--offsetif the loop doesn't start on the bar). Without a tempo it guesses chord changes from note onsets. That works on held chords and is unreliable on strummed comping, where every strum looks like a change. - Notes are moved, never invented. Turning C into Cmaj7 needs a B that isn't being played, so it reports that instead of faking it.
- Only chord tones move. Passing tones and notes still ringing from the previous chord are left as played.
- Mono or stereo, 16/24/32-bit WAV in, same format out. Harmonic material only: no drums, as planned for v1.
Next: checkpoint 5
The one-screen app: drop a loop, see its chord blocks, click a chord to swap it, hear the result immediately, and drag the WAV out into Ableton, Logic or FL Studio.