A technical support community for Apple Logic Pro users.

 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

midi latency at recording, not the average problem

Thu May 06, 2021 7:35 am

Hi, my first post here. I've worked with logic since 2012 on and off and know my way around pretty good, but this one problem has bugged me and I've never found a way to solve it. The problem is simply that when I record midi the notes are recorded too late. When using 1024 recording buffer it is recorded about 50 ms too late, when using 32 sample recording buffer the delay is about 4-8 ms. See this youtube clip for a demonstration where I record audio and midi at the same time:
https://www.youtube.com/watch?v=Yy2s0puhNLQ

Most people who record midi seems to want to quantize it before using it further, in that case you're fine and don't need to worry I guess. The same goes if you are willing to change the audio buffer to 32 ms when recording, that shrinks the problem to be manageble. I prefer to use 512 though since I don't want pops and clicks and also I don't have a very fast computer.

And also the most confusing to me is that I don't get why this is a problem. Logic automatically delay compensates audio, you can record at 1024 buffer and still the audio sync up perfectly, believe me I've tried this. But why doesn't it work with midi? Do you know how I can get it to work? Or is this such a weird use case that Logic isn't built for it? And just to clarify, this isn't only a problem when I record both audio and midi at the same time, I recorded both in the youtube-clip to demonstrate the delay, off course the midi delay is there even if I wouldn't choose to record audio at the same time.

Edit 1
20210521: I use direct monitoring, not software monitoring. And the problem is where the midi lands on the grid after they hqve been recorded, nothing else.

Edit 2
20210522 We've discussed this back and forth for a long time and haven't come up with any other solution than lowering the buffer size setting. I think all of us agree that there could exist a solution to this, is not impossible we just haven't found it. There is some disagreement among the writers in the thread weather the audio is placed too early or the midi too late. I'm totally sure that it is the midi that gets placed too late but I've been wrong before...
The question was originally about sending audio and midi to logic at the same time to Logic. But the discussion has also touched on sending midi from Logic to a hardware synth and recording the sound. With high buffer settings the recorded sound ends up too early. There are two solutions to this, tweak the value of the midi delay in the settings or turn on auto delay on the external midi track that triggers the midi. The first solution is the one totally preferred by me because when you record audio from an external synth that gets triggered by midi clock, that clock needs to be delayed as well so you might as well delay all midi information from Logic, not just the midi notes.
Last edited by mrcarlzone on Sat May 22, 2021 12:26 pm, edited 2 times in total.
 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

Re: midi latency at recording, not the average problem

Sat May 15, 2021 1:02 pm

I'm wondering why there aren't any answers. Is it because the question isn't clear or nobody else has this issue or nobody has the answer or something else?
 
User avatar
triplets
Posts: 18552
Joined: Wed Sep 14, 2005 3:21 pm
Location: North Hollywood
Contact:

Re: midi latency at recording, not the average problem

Sat May 15, 2021 2:30 pm

With a high buffer you will get latency, doesn't matter what you do.
The problem is, there will always be latency. It's basic physics.
Sound also has latency, we just can't hear it.
A computer has to make calculations in real time to compensate things, but there will always be latency.

And with audio and midi being recorded at the same time, it's more calculations.
And if you're using heavy 3rd party plugins, even worse.
So the best you can do is keep the buffer low and don't use latency-inducing plugins, or engage low-latency mode when you record.
Logic Pro 9 Master Pro and X certified
ProTools 10 & 11 Certified Operator
2 x 3.06 Intel Six-Core 24 GB RAM, Logic 10.5.1, 10.14.6., UA Apollo
2012 i7 MBP 8 GB Logic 10.6.1, 10.15.7
Contact me for Logic help (Teamviewer, Zoom, Skype)
http://www.ultimatestudiosinc.com
 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

Re: midi latency at recording, not the average problem

Sat May 15, 2021 11:07 pm

Thank you for answering, lowering the buffer and removing plugins seems to be the only way to handle this problem. But the claim that you make that you always should use a low buffer when recording is not all true. There could be a way for Logic to solve this, I thought there was, but now I think it is not implemented.

The thing about audio latency is that it actually is possible to choose the highest buffer settings and even slam on a limiter with 50 ms look ahead on the master and still have no trouble recording audio which syncs perfectly. That's because there are latency compensation on audio tracks! Here's a demo that I made. In the video i have connected cables from output 1-2 on my sound interface and connected them back to input 1-2 (of course with no monitoring, that would yield a nasty feedback):
https://youtu.be/da53HPawV8Q

My point is, why isn't it the same when using midi??
 
User avatar
triplets
Posts: 18552
Joined: Wed Sep 14, 2005 3:21 pm
Location: North Hollywood
Contact:

Re: midi latency at recording, not the average problem

Sun May 16, 2021 12:03 am

mrcarlzone wrote:
The thing about audio latency is that it actually is possible to choose the highest buffer settings and even slam on a limiter with 50 ms look ahead on the master and still have no trouble recording audio which syncs perfectly.


Sorry, I can't agree with this. The moment I put an Adaptive Limiter or any latency inducing plugin anywhere, I get audible latency when recording audio. And if I increase the buffer, it's worse.
So I don't know how you hear latency, but I can't play with it.
Logic Pro 9 Master Pro and X certified
ProTools 10 & 11 Certified Operator
2 x 3.06 Intel Six-Core 24 GB RAM, Logic 10.5.1, 10.14.6., UA Apollo
2012 i7 MBP 8 GB Logic 10.6.1, 10.15.7
Contact me for Logic help (Teamviewer, Zoom, Skype)
http://www.ultimatestudiosinc.com
 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

Re: midi latency at recording, not the average problem

Sun May 16, 2021 12:31 am

I should clarify, I dont use software monitoring, I use direct monitoring through my interface. If i would have used software monitoring, it would have been unavoidable I agree. But my question is about where the recorded sound ends up on the the grid. Like I tried to show in my example.
 
User avatar
triplets
Posts: 18552
Joined: Wed Sep 14, 2005 3:21 pm
Location: North Hollywood
Contact:

Re: midi latency at recording, not the average problem

Sun May 16, 2021 1:41 am

mrcarlzone wrote:
I should clarify, I dont use software monitoring, I use direct monitoring through my interface. If i would have used software monitoring, it would have been unavoidable I agree. But my question is about where the recorded sound ends up on the the grid. Like I tried to show in my example.


Ahh, now I get it.
Yeah, with direct monitoring and software monitoring turned off, you can see that Logic records ahead when you have a latency inducing plugin.

You can always mess with the Recording Delay slider and go down that rabbit hole.
I personally don't use direct monitoring.
Logic Pro 9 Master Pro and X certified
ProTools 10 & 11 Certified Operator
2 x 3.06 Intel Six-Core 24 GB RAM, Logic 10.5.1, 10.14.6., UA Apollo
2012 i7 MBP 8 GB Logic 10.6.1, 10.15.7
Contact me for Logic help (Teamviewer, Zoom, Skype)
http://www.ultimatestudiosinc.com
 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

Re: midi latency at recording, not the average problem

Sun May 16, 2021 2:56 am

Yes, and taking the example of audio recording logic kind of sorts it out using automatic recording latency compensation. The difference in clip number two is just 1 or 2 ms which is quit small to me, even when using a buffer of 1024 ms and a limiter plugin it works well. BUT considering midi in the first example there is no automatic adjustment of the midi track. If we assume that the audio is correctly placed timing wise, the midi is placed too late. That's my question, is there an automatic timing adjustment for midi or not? I'm guessing now that there aren't.
 
User avatar
triplets
Posts: 18552
Joined: Wed Sep 14, 2005 3:21 pm
Location: North Hollywood
Contact:

Re: midi latency at recording, not the average problem

Sun May 16, 2021 11:15 am

Did you try Low Latency Mode to see how it behaves with midi?
Logic Pro 9 Master Pro and X certified
ProTools 10 & 11 Certified Operator
2 x 3.06 Intel Six-Core 24 GB RAM, Logic 10.5.1, 10.14.6., UA Apollo
2012 i7 MBP 8 GB Logic 10.6.1, 10.15.7
Contact me for Logic help (Teamviewer, Zoom, Skype)
http://www.ultimatestudiosinc.com
 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

Re: midi latency at recording, not the average problem

Sun May 16, 2021 12:14 pm

yes, it doesn't do any difference unfortunately
 
gacki
Posts: 172
Joined: Fri Jul 17, 2020 3:18 am

Re: midi latency at recording, not the average problem

Sun May 16, 2021 1:45 pm

I wonder if this is possibly interface (driver) latency compensation going wrong. In other words: MIDI isn't recorded too late but the audio material is placed too early in relation to it.
AFAIK this could be fixed with the "Recording Delay" setting. Unfortunately Logic doesn't seem to provide a detailed explanation for this (anymore?).
I'd probably check first if MIDI data actually comes in late; this could be done with a single MIDI cable. Enter manually a couple of notes onto a MIDI track and record those then onto another MIDI track.
 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

Re: midi latency at recording, not the average problem

Sun May 16, 2021 11:15 pm

The problem has always been there for me, I've just changed sound interface. I've thought about it quite a lot and I think there are delay compensation for audio that works very well, that is illustrated in the second youtube-link I included in this thread. In that example I send audio from logic, through the DA then routed back trough the AD and into logic again. When I've selected a buffer of 1024 ms there are of course quite a lot of latency but logic is aware of that and when the recording is done it moves the audio to the right position, it's just a mere 2 ms off in my example. So your idea of audio coming in too early is not correct. It's the midi that is the problem.

This is actually a bit complex but I've understand it like this. Logic sends a sound at time t, when it is send through DA it is delayed by d1 arriving at t + d1. If I sing through a microphone at t + d1 that sound must travel through the AD and will arrive at time t + d1 + d2. But logic is not stupid and places it at time t + d1 +d2 on the grid, it knows the value of d1 and d2 based on the setting of the record buffer and what extra latency the plugins adds. So Logic subtracts d1 + d2 from the time and places the audio coming from the microphone at time t +d1 +d2 - (d1 + d2) = t. So everything is good!

But the problem I'm talking about in this thread arises when I play on my midi controller, I try to match the time t, but I'll have to wait until I hear it being played and that happens at time t + d1. The midi doesn't travel through the AD, it goes much faster, but still arrives at t + d1. Logic could have subtracted d1 from the midi timing to place the note at time t but somehow it doesn't take d1 into account, it places the midi note at t + d1 on the grid.

This is how I think it works, I don't know if my explanation made any sense. I'm wondering if there are midi delay compensation on recorded midi notes, and it seems like there are not.
 
User avatar
triplets
Posts: 18552
Joined: Wed Sep 14, 2005 3:21 pm
Location: North Hollywood
Contact:

Re: midi latency at recording, not the average problem

Mon May 17, 2021 1:52 am

mrcarlzone wrote:
This is how I think it works, I don't know if my explanation made any sense. I'm wondering if there are midi delay compensation on recorded midi notes, and it seems like there are not.


This might interest you:

https://admiralbumblebee.com/music/2020 ... Logic.html
Logic Pro 9 Master Pro and X certified
ProTools 10 & 11 Certified Operator
2 x 3.06 Intel Six-Core 24 GB RAM, Logic 10.5.1, 10.14.6., UA Apollo
2012 i7 MBP 8 GB Logic 10.6.1, 10.15.7
Contact me for Logic help (Teamviewer, Zoom, Skype)
http://www.ultimatestudiosinc.com
 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

Re: midi latency at recording, not the average problem

Mon May 17, 2021 5:31 am

Thanks but I didn't find a solution in the link. The author of that article seemed to compare the latency between different DAW:s. I accept that there is latency, I'm not affected by it while playing my midi controller because I don't use software synths that much. What I do care about is that the notes a play on the controller ends up on the right place on the grid. But the conclusion here is that I have to switch to the lowest possible buffer size while recording midi. It wouldn't have bother me so much if Logic didn't have a well implemented latency adjustment of the audio tracks. But now when Logic do have that I don't understand why they chose to not implement the same thing for MIDI.
 
gacki
Posts: 172
Joined: Fri Jul 17, 2020 3:18 am

Re: midi latency at recording, not the average problem

Mon May 17, 2021 6:10 am

mrcarlzone wrote:
So your idea of audio coming in too early is not correct. It's the midi that is the problem.

We don't know that; and it would be useful to make the check I described. Your second youtube video showed the re-recorded audio material slightly early as well so clearly there are some discrepancies in the way the interface reports its latency.
 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

Re: midi latency at recording, not the average problem

Mon May 17, 2021 7:29 am

You are right, I should try what you suggested.
 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

Re: midi latency at recording, not the average problem

Mon May 17, 2021 11:47 am

I've made the test that gacki mentioned and connecting the midi out to the midi in and it showed a very small timing difference:
https://youtu.be/EoghF6d794Q

I don't know if you guys could see that in my first video, if you pause at 0:31 you can actually see that the timing difference is 54 ms, measured with the "locators". I'm not really concerned with a timing difference which is just 2 ms, but 54 ms is not great.
 
User avatar
triplets
Posts: 18552
Joined: Wed Sep 14, 2005 3:21 pm
Location: North Hollywood
Contact:

Re: midi latency at recording, not the average problem

Mon May 17, 2021 1:34 pm

In your first video you record with the Adaptive Limiter on. That's a latency-inducing plugin that creates havoc. I always take it out of the channel when I record so I don't have to deal with the mess.
Logic Pro 9 Master Pro and X certified
ProTools 10 & 11 Certified Operator
2 x 3.06 Intel Six-Core 24 GB RAM, Logic 10.5.1, 10.14.6., UA Apollo
2012 i7 MBP 8 GB Logic 10.6.1, 10.15.7
Contact me for Logic help (Teamviewer, Zoom, Skype)
http://www.ultimatestudiosinc.com
 
gacki
Posts: 172
Joined: Fri Jul 17, 2020 3:18 am

Re: midi latency at recording, not the average problem

Mon May 17, 2021 1:53 pm

OK, let's try to unpack all of this.
There definitely IS some sort of problem but it's unclear to me where it comes from. There also seems to be some sort of misunderstanding of measurements which might lead to different expectations. And finally there is some stuff that doesn't make sense to me (yet).

Let's start with your first video. The 54 ms you thought you had measured are actually 28 ms (which I find still not acceptable!). But nonetheless it is about half of what we thought it was.
The number "54" is actually the "ticks" of the PPQ resolution of Logic. Logic has a 960 PPQ (Pulse Per Quarter) resolution (it actually is more complicated when it comes to audio data - but let's stick with this for now). This means that each quarter note can be divided into 960 parts (which equals 240 subdivisions within a 16th note).
So how long is such a subdivision? Well, that naturally depends on the tempo.
Your example has a tempo of 120 BPM. This means 1/4 notes are each 500 ms long. This gives for each "tick" or "pulse" a length of 500/960 = 0.52 ms. This number is different for different tempos!
0.52 ms per tick x 54 ticks = 28.08 ms. Still not acceptable in my book.

Second video: Audio is placed consistently about 2 ticks early (when latency compensation is on); this equals around 1 ms at 120 BPM. This difference is probably independent from the tempo (you'd get a different number of ticks for different tempos but it probably will stay around 1 ms). This could be a driver issue but I agree that this is very minor. This COULD also mean that the driver is working satisfactory for audio alone.

Third video: My takeaway is that there is no delay in the reception of MIDI data, at least not in a loopback situation. The difference for the first example was 2 ticks early (around 1 ms), for the second one 1 tick late (around 0.52 ms). And actually the audio buffer size should NOT affect the timing at all. So I'm rather inclined to mark this down as "jitter" in MIDI reception. This COULD also mean that the driver is working satisfactory for MIDI alone.

So what can we make out of all of this?
Time for another test: simultaneous loopback of both audio and MIDI (without any plugins and so on).

Out of interest I did this with my cheapo M-Audio interface and the results are ... interesting.
 
mrcarlzone
Topic Author
Posts: 36
Joined: Thu May 06, 2021 7:13 am

Re: midi latency at recording, not the average problem

Mon May 17, 2021 11:26 pm

triplets wrote:
In your first video you record with the Adaptive Limiter on. That's a latency-inducing plugin that creates havoc. I always take it out of the channel when I record so I don't have to deal with the mess.


In my first video I actually wasn't using adlimit. I just redid the example to confirm.

While I was doing that I found something else. When I changed sound from piano to organ on my nord stage the distance between the midi and the sound transient increased from 50 to 70 ticks. It seems like the nord has a built in latency when playing piano samples. The organ sound is not samples but modelled, that could be the reason for the difference.

I will continue when I have more time later today.