Topic: Questions regarding measured latency

Hi piano lovers.

I've done some measurements regarding latency.

With 192 samples (4 ms) I have a total latency of 20 ms; 16 ms come from elsewhere (the exact start of the sound signal is not very distinguishable)
With 384 samples (8,0 ms) I have a total latency of 72 ms; 64 ms come from elsewhere
With 576 samples (12,0 ms) I have a total latency of 105 ms; 93 ms come from elsewhere
With 960 samples (20,0 ms) I have a total latency of 106 ms; 86 ms come from elsewhere
With 1920 samples (40,0 ms) I have a total latency of 168 ms; 128 ms come from elsewhere
With 3840 samples (80,0 ms) I have a total latency of 286 ms; 206 ms come from elsewhere

It is clear to see, that with increasing samples, not only the audio buffer size-latency (in ms) increases, but there is an additional increase in latency (except for 20,0 ms, where it lowers).

Has anybody ideas where total latency consists of?
Are my results comparable to what others measure?


Most of the time, I use 256 samples (5,3 ms) to avoid cracks (with 4 ms I occasionally hear cracks).

My system: cpu: 4xAMD Phenom II X4 (running at 3,4 GHz: governor: performance).
OS: Linux 64 Bit (Kubuntu 18.04, normal kernel)
My piano: Yamaha cp33. MIDI over USB (cable length about 1,5 m)
My sound card: Focusrite scarlett 2i2 (2nd gen.)
My loudspeakers: Yamaha HS7
I have tested with Zoom H2n sound recorder and Audacity

Have a nice day & happy playin'

Yamaha CP33 -- Scarlett 2i2 -- Yamaha HS7 / Sennheiser HD650 -- PTQ 8 Pro [Linux] -- Some instruments

Re: Questions regarding measured latency

Viridis wrote:

(the exact start of the sound signal is not very distinguishable)

To make the start of the keystroke and sound from the speaker clear distinguishable in the waveeditor, I used a higher note (c5) in recent tests. You can try that.

Method? Did you make a one-channel-recording of both sounds? (separate channels for both signals are error-prone).
Did you play the test-note mf, f, ff? (the slower the key movement, the longer the key travel from contact 1 to 2, the bigger the latency)

Did you read the Pianoteq's README_LINUX.txt? (... the latency is 3 times the buffer size ...)

Each MIDI-keyboard has an individual MIDI-latency (known/unknown?)

What is the latency of your Yamaha CP33 internal sound determined under the same conditions? How much better/worse compared with your Pianoteq?

Connections have individual latencies (USB 1, USB 2, MIDI-Serial (5-pin), Bluetooth LE)

Most questions were already discussed in this forum, maybe you can find a few answers by reading.

Cheers

Last edited by groovy (06-10-2019 18:26)

Re: Questions regarding measured latency

Viridis wrote:

With 192 samples (4 ms) I have a total latency of 20 ms; 16 ms come from elsewhere (the exact start of the sound signal is not very distinguishable)
With 384 samples (8,0 ms) I have a total latency of 72 ms; 64 ms come from elsewhere

Yesterday I made some similar measurements.  My measurement setup actually involves seven pieces of equipment: a Korg LP-380 piano, a Roland MIDI router, a hardware synth, the Linux computer running Pianoteq, one of two audio interfaces (Scarlett or Notepad8-FX), and a hardware multitrack recorder.

The synth connected over MIDI responds to a MIDI note from the piano before the piano makes a sound, and reveals that the latency of Korg's sample player inside the piano is about 2 ms, or at least in the range of 1-3. (This calculation factors in about .7 ms for a 3-byte note-on message from the piano to reach the synth at 38,500 bps).

At 192 samples, my measurement of total latency for Pianoteq is very comparable to yours: about 23 ms. Modartt says to expect 3x the buffer size, but 20ms is about 4x or 5x the buffer size.

But then your result at 384 samples really sticks out, because it has jumped to 9x the buffer size! I wonder what could be happening there.

Re: Questions regarding measured latency

It is interesting that in the piano, the time span between reaching the bottom of the key and hitting the hammer on the string reaches a range from -15 to +25 ms .. depends on the dynamics and the preliminary state of the hammer (at rest or on the fenger ... or on a double rehearsal spring ..or in the air ..)

Re: Questions regarding measured latency

scherbakov.al wrote:

It is interesting that in the piano, the time span between reaching the bottom of the key and hitting the hammer on the string reaches a range from -15 to +25 ms .. depends on the dynamics and the preliminary state of the hammer (at rest or on the fenger ... or on a double rehearsal spring ..or in the air ..)

Thank you! I have been wondering about the time for the hammer to reach the strings.

I feel that my Korg keybed is quite slow and heavy and includes some of this time, but I don't know of any way to determine how much.

(Maybe this time is even included in the Pianoteq model. Do notes with low velocity sound later than notes with high velocity? It all seems a bit difficult, because it depends on the controller. The software should probably do one thing if you are playing a common semi-weighted keyboard, and do something else quite different if you are playing a VPC-1...)

Re: Questions regarding measured latency

JD wrote:

Do notes with low velocity sound later than notes with high velocity?

If the notes are triggered by MIDI keyboard: yes.

Contemporary keyboards usually have a minimum of two contacts per key. The pressed key reaches one after the other and the velocity is computed when the second contact closes.

The faster the key moves, the earlier the second contact is reached and  the corresponding velocity is computed.

If you like, you can determine it by recording the acoustic noise from your fingernail on the key and the following acoustic sound from the speaker with a microphone. Every built-in mic in a notebook will do. In a waveeditor like audacity you can see the time difference/latency between those two signals.