0

I had a digital piano for a while, and recently tried using it to record music via USB in Renoise. Input lag was inconsistent. A quick Google search reveals that the issue is widespread, regardless of what software or hardware is used.

So I wonder: why? USB keyboards and mice have been giving precise, instantaneous response for decades. Why do digital music instruments struggle with the timing of what should be simple key up/down signals when used via USB?

  • 1
    There are three possible causes of lag: transmission of the key presses over USB to the computer and the software, rendering into sounds, and playback of the sounds. I suspect the last one (which has nothing to do with USB MIDI). Do you still get input lag when you configure the computer to send the MIDI messages directly back to the piano? – CL. Mar 18 at 8:41
  • I just have the software record. I mute the PC audio and play to later find it's not the same (a couple >300ms lags here and there). And yeah I checked quantization is disabled. Using the keyboard instead of the piano (something which Renoise has built-in tutorials.renoise.com/wiki/…) works flawlessly even with direct playback of CPU-hungry VSTs. I have the piano sitting in the other side of the room right now so I can't test anything, but I concur it might be interesting to see if issues occur the other way round as well. – Zyl Mar 18 at 22:48
1

It depends a lot on the kind of Midi interface employed. The good news is that USB1.1 full speed (12MBps) is plenty. The bad news is that a number of cheap interfaces (the really notoriously bad interfaces, by the way, having a violin clef printed on them as a warning) actually use low speed (1.5MBps) which sounds like a whole lot compared to the 32.125kbps of a Midi connection but actually causes lag and jitter once you package into USB packets, arbitrate on the bus and deal with USB actually being a half-duplex rather than a full-duplex connection.

Now the kind of Midi events generated differ from keyboard to keyboard and the attack of the sound can only commence once the key event has arrived completely and been delivered to the software (so if you use your computer for sound expansion, you have inherent lag). If your sound system has less than minimal output buffering, additional delay gets added. It's actually here that the most prominent lag usually is located, with a bad Midi system actually being notorious mostly for "only" causing complete loss and/or garbling of events rather than general lag and jitter.

1

It's not the USB MIDI that is where the delay lies, it's the generation and digital to analog conversion of the sound. The amount of data that has to be processed to output a half second of audio is vastly greater than the amount of data processing needed to change a part of the display to show a character from the code page or show the mouse pointer in a different place.

Also note that changes in optical stimulus that take place in less than 1/30 of a second create the illusion of smooth motion, while the human ear can decode differences in two audio signals that differ in the range of 1/20,000 of a second.

Finally, when you are typing or moving the mouse, you are not trying to synchronize the response of the computer with anything external, so there might be latency that you don't even notice. When playing music, we are usually either trying to have the sound appear on the beat of a metronome or in our heads, or we are trying to synchronize with other instruments. It's much easier to hear the latency when you're playing with other than when you're just playing alone and are not trying to hit a precise time when you depress a key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.