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/
55•waveywaves•7h ago

Comments

waveywaves•7h 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•5h 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•1h 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•1h 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•1h 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•1h 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•57m 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•54m 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
swiftcoder•30m ago
Oh, right, forgot Tahoe made the error message for this so generic. Yeah, that did the trick
waveywaves•4m ago
Ah perfect ! Let me know what you think ! Also you can ping me on twitter if required https://x.com/BobadeVibhav/ Not really a twitter user, never been, but would be a easier way to connect obviously.
waveywaves•39m ago
The quickest way to fix this is clone the repo and run `cargo tauri dev` I believe.
owenfi•49m 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•40m 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 ?
waveywaves•35m ago
created https://github.com/contrapunk-audio/contrapunk/issues/8 https://github.com/contrapunk-audio/contrapunk/issues/9, let me know what you think

Show HN: A game where you build a GPU

https://jaso1024.com/mvidia/
678•Jaso1024•15h ago•149 comments

Show HN: I built a small app for FSI German Course

https://detawk.com/
24•syedmsawaid•2d ago•6 comments

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

https://contrapunk.com/
55•waveywaves•7h ago•18 comments

Show HN: I made open source, zero power PCB hackathon badges

https://github.com/KaiPereira/Overglade-Badges
93•kaipereira•17h ago•9 comments

Show HN: sllm – Split a GPU node with other developers, unlimited tokens

https://sllm.cloud
154•jrandolf•16h ago•76 comments

Show HN: M. C. Escher spiral in WebGL inspired by 3Blue1Brown

https://static.laszlokorte.de/escher/
68•laszlokorte•12h ago•12 comments

Show HN: TurboQuant-WASM – Google's vector quantization in the browser

https://github.com/teamchong/turboquant-wasm
152•teamchong•17h ago•6 comments

Show HN: OsintRadar – Curated directory for osint tools

https://osintradar.com/
2•lexalizer•2h ago•0 comments

Show HN: I built a frontpage for personal blogs

https://text.blogosphere.app/
755•ramkarthikk•1d ago•190 comments

Show HN: Signals – finding the most informative agent traces without LLM judges

https://arxiv.org/abs/2604.00356
3•sparacha•5h ago•0 comments

Show HN: Apfel – The free AI already on your Mac

https://apfel.franzai.com
714•franze•1d ago•146 comments

Show HN: Pluck – Copy any UI from any website, paste it into AI coding tools

https://www.pluck.so/
16•bring-shrubbery•20h ago•12 comments

Show HN: Vibooks – Local-first bookkeeping software built for AI agents

https://vibooks.ai/
2•adshao•7h ago•1 comments

Show HN: SeekLink – Local hybrid search and link discovery for Obsidian vaults

https://github.com/simonsysun/seeklink
2•simonsysun•7h ago•0 comments

Show HN: Ownscribe – local meeting transcription, summarization and search

https://github.com/paberr/ownscribe
11•paberr•19h ago•0 comments

Show HN: ctx – an Agentic Development Environment (ADE)

https://ctx.rs
48•luca-ctx•1d ago•52 comments

Show HN: Travel Hacking Toolkit – Points search and trip planning with AI

https://github.com/borski/travel-hacking-toolkit
92•borski•1d ago•37 comments

Show HN: Self-Host Excalidraw with Collaboration and Storage

https://github.com/ZimengXiong/ExcaliDash
2•zimengx•9h ago•1 comments

Show HN: Artemis.fyi - Real-time tracker for the Artemis II Moon mission

https://artemis.fyi/
9•dmk•9h ago•0 comments

Show HN: SwarmFeed – An X-like social platform built for AI agents

https://www.swarmfeed.ai/
3•jamesweb•10h ago•0 comments

Show HN: Dev Personality Test

https://personality.4m1r.dev/
5•4m1rk•10h ago•3 comments

Show HN: DocMason – Agent Knowledge Base for local complex office files

https://github.com/jetxu-llm/docmason
6•Jet_Xu•15h ago•0 comments

Show HN: Uncompressed – Self-hosted Netflix alternative at 60 Mbps instead of 15

https://uncompressed.media
3•lackoftactics•10h ago•0 comments

Show HN: Mtproto.zig – High-performance Telegram proxy with DPI evasion

https://github.com/sleep3r/mtproto.zig
21•slp3r•1d ago•14 comments

Show HN: Ismcpdead.com – Live dashboard tracking MCP adoption and sentiment

https://ismcpdead.com
35•sagirodin•1d ago•23 comments

Show HN: Dull – Instagram Without Reels, YouTube Without Shorts (iOS)

https://getdull.app
152•kasparnoor•3d ago•117 comments

Show HN: Made a little Artemis II tracker

https://artemis-ii-tracker.com/
149•codingmoh•2d ago•55 comments

Show HN: Tokencap – Token budget enforcement across your AI agents

https://github.com/pykul/tokencap
7•pykul•18h ago•0 comments

Show HN: AdaShape-3D modeler for intuitive 3D printing parts / Windows 11

https://adashape.com
4•fsloth•19h ago•2 comments

Show HN: Kaoslabs – High-intensity AI video and visual experiments

https://kaoslabs.org
5•wilhart•15h ago•0 comments