[PD] MIDI on Win XP

Ingo Scherzinger ingo at miamiwave.com
Sun Jan 6 08:38:58 CET 2008

Of course there is no latency of 3 ms with a setting of 3 ms!

First it's important to not mix up audio latency with MIDI latency.
Audio latency needs twice the latency plus ad/da conversion plus internal
processing time of the software. That should be around 9-10 ms with a good
soft- and hardware. For audio there is hardly no jitter. Once the system
(and software) is set up it stays stable.

With MIDI Latency it's a completely different situation.
Let's add this up:

1) Key regognition of the keyboard needs abaout 1 ms (with nearly the same
amount of jitter).
2) MIDI transmission needs about 1 ms per note.
3) MIDI recognition and transfer to the software may take up to 1 ms.
4) The latency of the software is only up to the software.
5) The buffer size is 3 ms so you get at the minimum 3 ms.
   This is the important part: The jitter introduced here is equal to the
buffer size of the soundcard. This means latency is total between 3-6 ms.
6) D/A conversion takes 1.5 ms with a good card like the RME HDSP. It can
take up to two or three times as long with bad converters.
7) Once the sound gets to the speakers it takes 3 ms to travel through the
air to your ears if you are about 1 m away from the speakers.

Adding all of this up means that the time that has passed between pressing
the key and the time until the sound arrives at your ears is 10.5 - 13.5 ms
with a buffer setting of 3 ms with good hardware no latency of the software
and a short distance to the speakers.
Having bad converters, extra software buffers and a larger distance to the
speakers may easiely double this.

The real reason why it is important to keep the buffersize as low as
possible is to obtain th minimum amount of jitter.

Using the above example with a buffersize of 512 samples will result in
latencies between 19.5 and 31.5 ms.

It's still no problem to play at 30 ms latency if the latency stays
consistent. It's the increasing jitter that will screw up the timing of the

So far we are still talking about an ideal case of a good soundcard with a
PCI (low jitter) MIDI interface.

USB MIDI introduces absolutely unpredictable jitter.
The jitter with the USB MIDI interface increases as the latency gets lower
because the system is busy doing other things and putting the USB MIDI
priority at a lower level.
In this case - instead of lowering the jitter like in the example above -
jitter is going to increase at lower audio buffer settings. So the lower
latency you may get from the low audio buffer may be nothing compared to the
additional delay and jitter when cpu load gets above a certain level.

You don't even want to start talking about using USB MIDI while using USB
audio. That's hi buffers with the highest MIDI jitter.

That is the reason why I use cards like the RME HDSP PCI cards with onboard
MIDI and fast converters.

So now you should see clearly that buffer size is only a number that refers
merely to the amount of jitter introduced on a PCI based MIDI-/soundsystem.
It has nothong to do with "real world" latency.

Ingo Scherzinger

> -----Ursprüngliche Nachricht-----
> Von: Roman Haefeli [mailto:reduzierer at yahoo.de]
> Gesendet: Sonntag, 6. Januar 2008 05:08
> An: Patrice Colet
> Cc: Ingo Scherzinger; pd-list at iem.at
> Betreff: Re: [PD] MIDI on Win XP
> On Sat, 2008-01-05 at 14:26 +0100, Patrice Colet wrote:
> > Ingo Scherzinger a écrit :
> > >> MIDI on XP is bad indeed, and I have to run my midi application under
> linux
> > >> to get a latency lower than human sound perception, without
> artefacts, and
> > >> with a cheap soundcard.
> > >
> > >
> > > I am running PD on several Windows XP machines with a latency of 3 ms
> (both
> > > souncard and pd).
> > > I have RME HDSP, Midiman Audiophile 2494 and AC97 souncards on those
> > > machines.
> > > Even a cheap (intel) mini itx board with a Celeron 1,33 GHz CPU and an
> AC97
> > > souncard works flawlessly here at 3 ms.
> > >
> >
> > How do you know it has 3ms latency, I think it's merely impossible.
> i don't believe either, that 3ms means the round trip. i measured the
> round trip of pd/jack/linux with a latency of 2.9ms in jack and i got
> ~7.8ms (which is _very_ ok for me).
> roman

More information about the Pd-list mailing list