7 comments

  • rohit_g1 minute ago
    finally some good stuff on here
  • waveywaves8 hours 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&#x2F;play in and the voice leading style and which part of the harmony you would like to play as, as well.<p>macOS DMG: <a href="https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;releases&#x2F;tag&#x2F;v1.0.0" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;releases&#x2F;tag&#x2F;...</a><p>Source: <a href="https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk</a> (do open any issues if you have any)<p>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.
    • seertaak51 minutes ago
      <i>Gradus ad Parnassum!</i> What a cool idea, and the fact it&#x27;s counterpoint gives you a nice little time buffer for any DSP. Super cool
      • waveywaves45 minutes ago
        Thank you! The idea is not completely mine, I have to give thanks to Abhinav Arora who had this idea initially during the ADCx music hackathon. Kudos to him! Also love the phrase Gradus ad Parnassum! Maybe this should be the motto of contrapunk :)
        • seertaak24 minutes ago
          Contrapunk is a cool name though.<p>How are you finding rust for audio development? I have a background in pro audio, and both for the audio and GPU render threads, I used a lot of arena allocators and ring buffers. Do you find yourself fighting with rust&#x27;s strict semantics?
    • Slow_Hand4 hours ago
      Cool idea!<p>I&#x27;ve got a few thoughts for features, if you&#x27;re open to them:<p>1. Ability to specify where your &quot;played&quot; voice resides in the voicing: As the bass note, as an inner voice, or as the top line.<p>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.<p>3. If you want to get real fancy, make the generated voices perform a canon of your played notes.
      • waveywaves2 hours 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&#x27;s not as strict as it should be but that&#x27;s also something I need to work on. Regarding 2. it&#x27;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 <a href="https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;</a>
    • chrisweekly6 hours ago
      &quot;Realtime&quot; as in &quot;while playing guitar&quot; has some pretty challenging latency requirements. Even if your solution is optimal, hardware specs will play a meaningful role. I&#x27;d be really interested if you&#x27;ve solved for this e2e.
      • waveywaves2 hours ago
        Yes, latency was the main problem to solve here. Because of which I opted for Rust. The pipeline is:<p>- 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<p>The e2e from pluck to MIDI &quot;note-on&quot; 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. <a href="https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;6" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;6</a>.
  • korginator1 hour ago
    There was a 1970&#x27;s Indonesian progressive rock band called Contrapunk that released an album called &quot;Putri Mohon Diri&quot; [1]<p>You can find the recording on YT [2] They were really unique - blending traditional Indonesian instruments, intense guitar work and classical influences.<p>[1] <a href="https:&#x2F;&#x2F;www.discogs.com&#x2F;release&#x2F;17424685-Contrapunk-Putri-Mohon-Diri" rel="nofollow">https:&#x2F;&#x2F;www.discogs.com&#x2F;release&#x2F;17424685-Contrapunk-Putri-Mo...</a><p>[2] <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=jb1792ZuXcY" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=jb1792ZuXcY</a>
    • waveywaves43 minutes ago
      Ah banger from the get go. Guess this is what I will be listening to through rest of the day. And I will add this as a fun fact to the website as well. Thank you for sharing :)
      • setnone13 minutes ago
        &gt; Guess this is what I will be listening to through rest of the day<p>You won&#x27;t be alone :)<p>Such a cool project and the name and thanks for making it open source!
  • owenfi2 hours ago
    I&#x27;ve been thinking of and briefly working on a similar project.<p>One idea is to analyze timing as well, and &quot;trigger&quot; 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.<p>I haven&#x27;t done any Rust, but this might give me a good reason to give a try.<p>Have you considered making it a plugin? (makes replay easier in my opinion, but brings other pain like relaunching the DAW between builds...)
    • waveywaves2 hours ago
      I had added a metronome and a note generator to this earlier which aren&#x27;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 ?
    • waveywaves1 hour ago
      created <a href="https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;8" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;8</a> <a href="https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;9" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;9</a>, let me know what you think
  • swiftcoder2 hours ago
    Seems like the Mac app has a packaging problem. Tahoe on an M2 Max views it as corrupted and refuses to launch it
    • waveywaves2 hours ago
      The quickest workaround for this would be running ` xattr -cr &#x2F;Applications&#x2F;Contrapunk.app`. Are you able to use the web version though at app.contrapunk.com
      • kimi1 hour ago
        I was bitten by the same issue. Maybe add a line to the docs.
        • waveywaves36 minutes ago
          Added to the README, apologies for that.
      • swiftcoder1 hour ago
        Oh, right, forgot Tahoe made the error message for this so generic. Yeah, that did the trick
        • waveywaves1 hour ago
          Ah perfect ! Let me know what you think ! Also you can ping me on twitter if required <a href="https:&#x2F;&#x2F;x.com&#x2F;BobadeVibhav&#x2F;" rel="nofollow">https:&#x2F;&#x2F;x.com&#x2F;BobadeVibhav&#x2F;</a> Not really a twitter user, never been, but would be a easier way to connect obviously.
    • waveywaves2 hours ago
      Ah sorry about that. Let me see what&#x27;s up. I am able to run it locally on my M2 Pro. Not running Tahoe. Filed an issue <a href="https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;7" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;7</a>
    • waveywaves2 hours ago
      The quickest way to fix this is clone the repo and run `cargo tauri dev` I believe.
  • marssaxman7 hours ago
    What a cool idea. I don&#x27;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&#x27;d gladly listen to them.<p>How do you generate velocity values for the accompaniment notes?<p>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&#x27;re in, and it starts following along as soon as it catches on.
    • waveywaves2 hours ago
      Thank you! The best part about this project is that you don&#x27;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. <a href="https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;4" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;contrapunk-audio&#x2F;contrapunk&#x2F;issues&#x2F;4</a> 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?
  • r2ob5 hours ago
    Wow that&#x27;s is really cool! Thanks for sharing! I will definitely take a look
    • waveywaves3 hours ago
      Thanks for taking a look! Let me know if you have any issues with it, it&#x27;s still in a nascent stage and has a lot of room to grow especially in the Guitar to MIDI detection. If you don&#x27;t have a midi controller you can use your keyboard as well !