<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Hrishikesh Dhanlobhe</title>
    <description>The latest articles on DEV Community by Hrishikesh Dhanlobhe (@hrishikesh_dhanlobhe).</description>
    <link>https://dev.to/hrishikesh_dhanlobhe</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4250034%2F7f57f51f-24e1-4d6a-94c4-5232ef634a5d.png</url>
      <title>DEV Community: Hrishikesh Dhanlobhe</title>
      <link>https://dev.to/hrishikesh_dhanlobhe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hrishikesh_dhanlobhe"/>
    <language>en</language>
    <item>
      <title>Why is my piano late? Measuring audio latency on a normal Windows PC</title>
      <dc:creator>Hrishikesh Dhanlobhe</dc:creator>
      <pubDate>Tue, 17 Nov 2026 14:19:40 +0000</pubDate>
      <link>https://dev.to/hrishikesh_dhanlobhe/why-is-my-piano-late-measuring-audio-latency-on-a-normal-windows-pc-38ki</link>
      <guid>https://dev.to/hrishikesh_dhanlobhe/why-is-my-piano-late-measuring-audio-latency-on-a-normal-windows-pc-38ki</guid>
      <description>&lt;p&gt;I'm a CSE student at IIIT Raichur. In my first-year holidays I had a simple idea: I own a Casio CTK-2500, which has an aux output but no MIDI. Could I do live looping and play other instruments' sounds using only my PC and software, with no audio interface?&lt;/p&gt;

&lt;h2&gt;
  
  
  Day one: the sound arrives late
&lt;/h2&gt;

&lt;p&gt;I plugged the piano into the blue line-in jack and the speakers into the green jack. When I pressed a key, I heard it very late, around 150–200 ms by feel. I couldn't play a section in time. Looking it up, I learned that normal Windows audio is built for reliability, not for low delay.&lt;/p&gt;

&lt;h2&gt;
  
  
  Trying faster drivers
&lt;/h2&gt;

&lt;p&gt;I installed WASAPI, ASIO4ALL and others. The delay dropped, but the sound had crackles and glitches. A smaller buffer means less time for the computer to deliver each block of audio, so a small buffer can break. Latency and crackle turned out to be one trade-off, not two problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Measuring instead of guessing
&lt;/h2&gt;

&lt;p&gt;I stopped guessing and built a measurement. The software plays a short chirp from the green jack. A cable brings it into the blue jack. The software finds the chirp in the recording and measures the delay. No extra hardware needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcvvnupmv0zxp66dv1li5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcvvnupmv0zxp66dv1li5.png" alt="Test setup: chirp out of the green jack, cable into the blue jack" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Results on my PC (block 256, 48 kHz):&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6x938bv80gubgqoxsgea.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6x938bv80gubgqoxsgea.png" alt="Round-trip latency by audio path (block 256, 48 kHz)" width="800" height="458"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;MME: 127.5 ms.&lt;/strong&gt; This matches the lag I felt on day one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WASAPI shared: 40.8 ms.&lt;/strong&gt; Clean sound, but too slow to play on.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;WASAPI exclusive: about 20 ms&lt;/strong&gt; (reported from earlier runs, not re-measured yet), but it crackled in 3 of 4 captures.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Finding where the crackle comes from
&lt;/h2&gt;

&lt;p&gt;I recorded a 1 kHz tone through the loop in each mode.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4zue88244ur343zsuxxf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4zue88244ur343zsuxxf.png" alt="Click timeline: shared mode clean, exclusive mode crackles" width="800" height="476"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Shared mode is clean. Exclusive mode shows about 2,000 clicks in 20 seconds. The important check: the signal my program hands to the audio system was a perfect sine wave in every capture. So the damage happens &lt;em&gt;after&lt;/em&gt; my program, in the driver, the sound card or the capture. That ruled out my own code, which was a relief.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faneg9sm4hvt0iwbvagnn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faneg9sm4hvt0iwbvagnn.png" alt="Clicks lining up on a 3 ms grid (one capture only)" width="800" height="378"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The clicks also line up on a 3 ms grid, which hints that the driver processes audio in fixed 3 ms periods. I only have one capture of this, and a 1 kHz tone could cause the pattern by itself, so I treat it as a lead, not a result.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I haven't proven
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;My measuring tools aren't calibrated yet, so all findings are low-confidence.&lt;/li&gt;
&lt;li&gt;The unplugged-cable control test crashed instead of reporting "no signal".&lt;/li&gt;
&lt;li&gt;Exclusive mode and ASIO4ALL still need the same formal measurement.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Where this goes next
&lt;/h2&gt;

&lt;p&gt;Once the delay is low and clean, the real plan starts: detect which notes I play from the audio (constant-Q transform or NMF with per-note templates), turn them into MIDI-like events, and play them through instruments my Casio doesn't have. Later, the same system could transcribe songs with ML models.&lt;/p&gt;

&lt;h2&gt;
  
  
  A note on how I worked
&lt;/h2&gt;

&lt;p&gt;I used Claude, an AI assistant, for study design, analysis scripts and much of the code. I ran every measurement on my own PC and made the decisions. Everything is on GitHub: &lt;a href="https://github.com/resonance-lab-iiitr/aux2note" rel="noopener noreferrer"&gt;https://github.com/resonance-lab-iiitr/aux2note&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What would you try next? Suggestions welcome.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>podcast</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
