MIDI negative latency

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
User avatar
peter.semiletov
Established Member
Posts: 119
Joined: Thu May 11, 2023 1:09 pm
Has thanked: 25 times
Been thanked: 82 times
Contact:

MIDI negative latency

Post by peter.semiletov »

Hello!
I have a problem with the recording from MIDI keyboard at Reaper and Ardour, so it seems it is not related to DAW settings. The notes sounds when I press keys without audible latency, but! They are recorded a bit shifted BEFORE the proper time.
I tried ALSA and JACK, but all that with Pipewire voodoo magic under the hood. Can Pipewire do something with wrong MIDI timing or so?
When things goes wrong? I don't remember and it is a key of the problem. Some time ago I upgraded my PC, switched to another sound card, installed Pipewrire instead of Pulse.
If I'll try to record MIDI on the notebook where is no Pipewrite, and if there will be no such "negative latency", how is that help me on the main PC? Maybe it's something and midi via usb stuff, I don't understand...
PS Arch Linux

User avatar
sysrqer
Established Member
Posts: 2527
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 320 times
Been thanked: 153 times
Contact:

Re: MIDI negative latency

Post by sysrqer »

What settings are you using for pipewire? What does pw-top report for ardour/reaper?

User avatar
peter.semiletov
Established Member
Posts: 119
Joined: Thu May 11, 2023 1:09 pm
Has thanked: 25 times
Been thanked: 82 times
Contact:

Re: MIDI negative latency

Post by peter.semiletov »

Reaper:

QUANT 0
RATE 0
WAIT 9..12us
BUSY 150..200us
W/Q 0,00
B/Q 0,01

User avatar
peter.semiletov
Established Member
Posts: 119
Joined: Thu May 11, 2023 1:09 pm
Has thanked: 25 times
Been thanked: 82 times
Contact:

Re: MIDI negative latency

Post by peter.semiletov »

And more info...
I have old MIDIPlus Indian keyboard, it worked well 10+ years with PCI M-Audio Audiophile (connected to its MIDI In port, and later via USB too). Now, on new motherboard, I use built-in ALC1212, and external USB M-Audio Solo (that sounds worse than ALC1212).

It drives me mad. Today I tried to record MIDI at my notebook (where I have ALSA + Pulse, no Pipewire), and I'm confused - probably I have a small notes shift there, but maybe not...

At the main PC, my experiments leads me to edit ./config/pipewire/ jack.conf - I set

Code: Select all

jack.properties = {
node.latency = 256/44100
node.rate = 1/44100
node.quantum = 256/44100
}

and somehow it seems it helps me (currently) with Reaper. It is strange, the latency settings must affect how notes lates, not how they appears earlier...
I use Reaper with Jack (via Pipewire), because Reaper with ALSA selected gives me no sound at all (if no pipewire-alsa installed), and I think it is due Pipewire. If I install pipewire-alsa, I get just glitches at Reaper and Ardour, so I removed pipewire-alsa to not resolve more problems.

I don't want uninstall Pipewire just to try MIDI recording without all traces of Pipewire, so I'll try to test more the current setup...

User avatar
sysrqer
Established Member
Posts: 2527
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 320 times
Been thanked: 153 times
Contact:

Re: MIDI negative latency

Post by sysrqer »

Is that all you have in your ~/.config/pipewire directory and file?
What about pw-top - what settings are actually being used?
Have you tried node.lock-quantum = true?

Where did you find this: node.rate = 1/44100? I can't see that listed in the documentation https://gitlab.freedesktop.org/pipewire ... onfig-JACK

I would guess that this is latency compensation happening in the daws rather than in pipewire but seems weird either way.

User avatar
sysrqer
Established Member
Posts: 2527
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 320 times
Been thanked: 153 times
Contact:

Re: MIDI negative latency

Post by sysrqer »

peter.semiletov wrote: Sun Dec 03, 2023 1:20 pm

Reaper:

QUANT 0
RATE 0
WAIT 9..12us
BUSY 150..200us
W/Q 0,00
B/Q 0,01

Where are these from?

User avatar
peter.semiletov
Established Member
Posts: 119
Joined: Thu May 11, 2023 1:09 pm
Has thanked: 25 times
Been thanked: 82 times
Contact:

Re: MIDI negative latency

Post by peter.semiletov »

sysrqer wrote: Sun Dec 03, 2023 2:22 pm

Is that all you have in your ~/.config/pipewire directory and file?

No, it is just that I uncommented at example jack.conf. All other things are default.

sysrqer wrote: Sun Dec 03, 2023 2:22 pm

What about pw-top - what settings are actually being used?

For Reaper pw-top shows that:

Code: Select all

QUANT 0
RATE 0
WAIT 9..12us
BUSY 150..200us
W/Q 0,00
B/Q 0,01
sysrqer wrote: Sun Dec 03, 2023 2:22 pm

Have you tried node.lock-quantum = true?

No, but I'll try, thanks!

sysrqer wrote: Sun Dec 03, 2023 2:22 pm

Where did you find this: node.rate = 1/44100?

At the example config file :)

sysrqer wrote: Sun Dec 03, 2023 2:22 pm

I would guess that this is latency compensation happening in the daws rather than in pipewire but seems weird either way.

Yes, but why at two different DAWs? I speaked with Paul Davis at Unfa's chat about this negative note offset, but there is no positive result for my problem :) I can't determine what is that can be. Thinking logically, if the latency compensation is wrong, it must sound wrong too. But I hear all notes just fine, for example, with metronome turned on, or with the drum track playing.

User avatar
sysrqer
Established Member
Posts: 2527
Joined: Thu Nov 14, 2013 11:47 pm
Has thanked: 320 times
Been thanked: 153 times
Contact:

Re: MIDI negative latency

Post by sysrqer »

Oh sorry, I didn't recognise the pw-top output and thought you meant those were the settings in Reaper :)

I don't know if it's something worth looking into but it seems odd that you get 0 for quant and rate. This is mine.

Screenshot_20231203_191153.png
Screenshot_20231203_191153.png (28.49 KiB) Viewed 11260 times

I would get rid of that config and start again with the one from the wiki linked above, maybe start as with as little uncommented as possible and work up from that, eliminate variables.

I'm not sure what else to suggest to be honest, I haven't experienced anything like that and it is odd that it's in two different daws. The quantum lock setting might help, I wonder if the setting is dynamically changing and any compensation in the daws is not reading the latency correctly.

Are you sure there's no automatic quantisation happening?

Post Reply