frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: Contrapunk – Real-time counterpoint harmony from guitar input, in Rust

https://contrapunk.com/
50•waveywaves•7h ago

Comments

waveywaves•6h ago
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.

chrisweekly•4h ago
"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.
waveywaves•42m ago
Yes, latency was the main problem to solve here. Because of which I opted for Rust. The pipeline is:

- 128-sample cpal audio buffers (~2.7ms at 48kHz) - Single-cycle pitch detection - 2-frame McLeod pitch voting for confirmation - Entire DSP pipeline is Rust, pre-allocated ring buffers with minimal heap pressure

The e2e from pluck to MIDI "note-on" signal, is under 10ms on an M-series Mac. Hardware matters for sure so an audio interface with low-latency drivers (I use an Audient iD14) helped a lot. The web version (app.contrapunk.com) adds AudioWorklet latency on top, so the native Mac app is noticeably tighter. I am still working on figuring out how to have lesser noise and pitch jitter in the final output. Also this works really well for higher notes, bass not so much right now. Still need to figure out how to handle harmonics better. I have created this issue for you for now, let me know if you would like to add anything else to this as well. https://github.com/contrapunk-audio/contrapunk/issues/6.

Slow_Hand•2h ago
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.

waveywaves•52m ago
Have you been able to try it as well would love to hear what you think! Coming back to the features, regarding 1. you can already choose between soprano, alto, tenor or bass. I have still filed an issue for this, will help me remember to take vet this feature. Sometimes it's not as strict as it should be but that's also something I need to work on. Regarding 2. it's a good idea, helps you be in control of the kind of counterpoint you are doing, filed an issue for the same. Please feel free to comment on the issue. 3. is just feels is a little goofy as well I love it. I haver filed an issue for this as well check https://github.com/contrapunk-audio/contrapunk/issues/
marssaxman•5h ago
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.

waveywaves•59m ago
Thank you! The best part about this project is that you don't actually need a elaborate setup :) All you need is a DAW like garage band or logic and a few IAC buses configured on your mac. I really like the idea of key detection, it is something I have already thought about as well: based on the song it should pick up the key which you can then jam to with contrapunk and I think it can act as an educational moment for the player as well at the time. https://github.com/contrapunk-audio/contrapunk/issues/4 I have created a github issue over here as well for this. For the velocity currently I am inheriting the onset strength of the input signal for the accompanied notes. The guitar input measures RMS energy in the first ~5ms of each pluck (the attack transient) and maps that to MIDI velocity. I will post more sample recordings on the website soon! Were you able to check the one which was already posted?
r2ob•3h ago
Wow that's is really cool! Thanks for sharing! I will definitely take a look
waveywaves•1h ago
Thanks for taking a look! Let me know if you have any issues with it, it's still in a nascent stage and has a lot of room to grow especially in the Guitar to MIDI detection. If you don't have a midi controller you can use your keyboard as well !
swiftcoder•35m ago
Seems like the Mac app has a packaging problem. Tahoe on an M2 Max views it as corrupted and refuses to launch it
waveywaves•23m ago
Ah sorry about that. Let me see what's up. I am able to run it locally on my M2 Pro. Not running Tahoe. Filed an issue https://github.com/contrapunk-audio/contrapunk/issues/7
waveywaves•20m ago
The quickest workaround for this would be running ` xattr -cr /Applications/Contrapunk.app`. Are you able to use the web version though at app.contrapunk.com
waveywaves•5m ago
The quickest way to fix this is clone the repo and run `cargo tauri dev` I believe.
owenfi•15m ago
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...)

waveywaves•6m ago
I had added a metronome and a note generator to this earlier which aren't working well exactly right now. But this would definitely increase playability. I agree that there should be a VST plugin version of this as well. It can also live as a standalone app and a plugin. Could you elaborate on the analyze timing? If you had to play using this, what would you like to hear ?

Software Engineering: Reflections on Process and Prioritisation

https://html.substack.com/p/reflections-on-process-and-prioritisation
1•database-shard•52s ago•0 comments

They All Fall Down

https://megam226.substack.com/p/they-all-fall-down
1•megam226•1m ago•0 comments

AGI won't automate most jobs–because they're not worth the trouble

https://fortune.com/2026/04/04/ai-jobs-future-not-important-enough-to-be-automated-yale/
1•Sandman•6m ago•0 comments

An AI bot invited me to its party in Manchester. It was a pretty good night

https://www.theguardian.com/technology/2026/apr/05/ai-bot-party-manchester-gaskell
1•mellosouls•11m ago•0 comments

Unpaved: Audit toolkit for AI developer tool bias in Global South contexts

https://github.com/moswek/unpaved
1•moswek•18m ago•1 comments

Good APIs Age Slowly

https://yusufaytas.com/good-apis-age-slowly/
2•birdculture•19m ago•0 comments

U.S. Rescues Officer from Downed Fighter Jet in Iran

https://www.nytimes.com/live/2026/04/05/world/iran-war-trump-news
3•ranit•25m ago•1 comments

Qwen 3.6 Free

https://openrouter.ai/qwen/qwen3.6-plus:free
3•Flere-Imsaho•25m ago•0 comments

Built brewmind.coffee because I kept wasting good coffee beans

1•BrewMind•30m ago•0 comments

H.264 licenses: Prices increase up to 45 times

https://www.heise.de/en/news/H-264-licenses-Prices-increase-up-to-45-times-11245915.html
2•doener•31m ago•0 comments

Aiper IrriSense 2 Smart Irrigation System Review: Clever yet Uneven

https://www.wired.com/review/aiper-irrisense-2-smart-irrigation-system/
1•joozio•35m ago•0 comments

What Teens Are Doing with Role-Playing Chatbots

https://www.nytimes.com/2026/04/04/technology/ai-chatbots-teen-roleplay.html
4•ytpete•35m ago•1 comments

I Give Up on Neovim

https://bittich.be/posts/give-up-on-neovim/
3•nbittich•36m ago•0 comments

Wander Console 0.4.0

https://susam.net/code/news/wander/0.4.0.html
1•susam•37m ago•0 comments

FBI labels suspected China hack of law enforcement data 'a major cyber incident'

https://www.nbcnews.com/news/us-news/fbi-labels-suspected-china-hack-law-enforcement-data-major-c...
2•NewCzech•39m ago•0 comments

Dynamics of (Not) Being Perceived: Grief and Relief After Leaving Social Media

https://networkcultures.org/thedigitalgutmensch/2026/04/02/dynamics-of-not-being-perceived-the-gr...
3•glovink•39m ago•0 comments

I built a local-first web-app that changes the way you think

https://cognir.netlify.app/
2•Sahil-Das•39m ago•0 comments

Lisette a little language inspired by Rust that compiles to Go

https://lisette.run/
2•jspdown•43m ago•1 comments

UK food halls buck downbeat hospitality trend: 'In this impossible climate'

https://www.theguardian.com/business/2026/apr/04/uk-food-halls-buck-downbeat-hospitality-trend
2•zeristor•45m ago•0 comments

Ask HN: Is AI-generated output copyrightable? Should it be?

2•robalni•51m ago•2 comments

Hi, I'm Brazilian and I'm thinking about moving to SF

1•leddo•56m ago•0 comments

Spain has the biggest concentration of greenhouses

https://www.theguardian.com/environment/2026/mar/29/europe-vegetable-garden-greenhouses-andalusia...
3•simonebrunozzi•58m ago•0 comments

Show HN: Bb – Windows API viewer for hackers, in the browser

https://cristeigabriela.github.io/bb-viewer/index.html
2•gabriela_c•1h ago•0 comments

The Visible Key – A New Way to Verify

https://aperceptualdrifter.substack.com/p/the-visible-key
1•braid_beards•1h ago•0 comments

World Models (Part 1)

https://www.youtube.com/watch?v=cTQL2xWmxrE
2•frag•1h ago•0 comments

GabeN Is Shitting Yacht Money into Flatpak and You're Still Arguing Init Systems

https://s3kshun8.games/blog/flatpak-won/
39•S3kshun8•1h ago•40 comments

Apple's Spotlight Search Results Come with Engagement Metrics. No One Knew

https://www.buchodi.com/apples-spotlight-search-results-come-with-engagement-metrics-no-one-knew/
3•politelemon•1h ago•0 comments

BYD flash charging 2026 Seal 06 GT starting from 16,200 US

https://carnewschina.com/2026/04/02/byd-launches-flash-charging-2026-seal-06-gt-and-seal-06-dm-i-...
2•KnuthIsGod•1h ago•0 comments

BYD reveals interior of refreshed Denza D9

https://carnewschina.com/2026/03/28/byd-reveals-interior-of-refreshed-denza-d9-ahead-of-march-29-...
1•KnuthIsGod•1h ago•0 comments

What Does ⍋⍋ Even Mean?

https://blog.wilsonb.com/posts/2023-08-04-what-does-grade-grade-even-mean.html
1•tosh•1h ago•0 comments