Show HN: Contrapunk – Real-time counterpoint harmony from guitar input (contrapunk.com)

118 points by waveywaves ↗ HN
Hi HN, I built Contrapunk because I wanted to play guitar and hear counterpoint harmonies generated in real-time. It takes audio from your guitar, MIDI player or your computer keyboard and generates harmony voices that follow counterpoint rules to generate harmonies. You can choose the key you would like to improvise/play in and the voice leading style and which part of the harmony you would like to play as, as well.

macOS DMG: https://github.com/contrapunk-audio/contrapunk/releases/tag/...

Source: https://github.com/contrapunk-audio/contrapunk (do open any issues if you have any)

Would love feedback on the DSP approach and the harmony algorithms. I am also looking at training a ML model for better realtime guitar to midi detection. I believe that will take some time.

22 comments

[ 1.2 ms ] story [ 44.9 ms ] thread
(comment deleted)
What a cool idea. I don't have a music setup capable of running this right now - perhaps in a couple of months - but if you were to post some sample recordings, I'd gladly listen to them.

How do you generate velocity values for the accompaniment notes?

Given that you already have a pitch tracker, it could be interesting to add key detection; just start playing, instead of telling the machine what key you're in, and it starts following along as soon as it catches on.

"Realtime" as in "while playing guitar" has some pretty challenging latency requirements. Even if your solution is optimal, hardware specs will play a meaningful role. I'd be really interested if you've solved for this e2e.
Wow that's is really cool! Thanks for sharing! I will definitely take a look
Cool idea!

I've got a few thoughts for features, if you're open to them:

1. Ability to specify where your "played" voice resides in the voicing: As the bass note, as an inner voice, or as the top line.

2. Options for first species, second species, third, florid, etc counterpoint for each of the generated voices. Ex: You play a single note and the upper voice plays two notes for every one of yours, etc, etc.

3. If you want to get real fancy, make the generated voices perform a canon of your played notes.

Seems like the Mac app has a packaging problem. Tahoe on an M2 Max views it as corrupted and refuses to launch it
I've been thinking of and briefly working on a similar project.

One idea is to analyze timing as well, and "trigger" things after certain sequences (so play 1-3-5 as say eighth notes and then get an in-rhythm arpeggio one octave higher) or detect the beat and play on the upbeat.

I haven't done any Rust, but this might give me a good reason to give a try.

Have you considered making it a plugin? (makes replay easier in my opinion, but brings other pain like relaunching the DAW between builds...)

Gradus ad Parnassum! What a cool idea, and the fact it's counterpoint gives you a nice little time buffer for any DSP. Super cool
finally some good stuff on here
Very cool!

FYI in this phrase: "AI is not going to kill music till people keep playing music together."

The "till" (until) kind of inverts what I think is the intended meaning.

A better replacement would be "as long as".

This is actually super cool!
Would be useful to have a video demoing it if people don't have a guitar or MIDI instrument handy.
How good is the guitar to MIDI detection? Can it recognize chords?
Unfortunately not right now, it's in the works. Polyphonic guitar to midi is a problem I am yet to understand and try solving in this one. Jam Origin's Midi Guitar is good like that, I still need to get there.
(comment deleted)
totally agree. tabs by ear is still the best way to internalize a song. chord sites are fine as a starting point but you miss so much of the nuance.
Yes sir, that is the best way. Learning music by ear is the best way to get through yes. What does your practice session usually look like ?
Harmonies: I notice that the Bach mode in C major, given the notes C-D-E, produces Dm7 Em7 Fmaj7. Something like C G7 Am would be more Bach.

If you're interested in adding more scales, I have a wider range in my scale builder: https://xn--langy-yua.net/skala