Jump to content

External Instrument - MIDI Latency issue


PatrickR

Recommended Posts

Hi there,

 

new to Logic and new to external gear -- up until now I've done everything "in the box". I recently acquired a Roland Boutique JX-03 Synth which is connected to my Macbook Pro via USB. The USB connection is for MIDI as well as Audio. Proprietary Roland Boutique drivers are installed and in the Driver settings I set "audio buffer size" to the lowest possible value. In Logic, I set Audio > Devices > Buffer size to 128. Audio > General > Software monitoring is off.

 

Let me explain my problem by giving an example. Let's say I have two tracks: One MIDI track and one audio track. The MIDI track sends the notes to the JX-03 via the external instrument plugin (MIDI destination: JX-03, audio Input: JX-03). "Auto compensate latency" box is ticked. I programmed the JX-03 to play a click sound and recorded an 8th note pattern as MIDI. Metronome is on. Whenever I play the pattern back, there is a perceptible delay of around 20-25ms between the metronome and the klick sound from the JX-03: The JX-03 lags behind the metronome. I measured the delay using the "track delay" setting via trial-and-error until the metronome and the sound from the hardware instrument lined up perfectly.

 

Now, when I record said pattern as audio on the audio track, the recording is either in sync (using no delay on the MIDI track) or a bit too early (using a delay compensation of around -20ms on the MIDI track). Am I missing something? Can I have both -- perfect monitoring AND a perfect recording, or always only one or the other?

 

I'm confused... any pointers/advice?

Link to comment
Share on other sites

I hope some others will respond, this is always confusing for me too.  

 

Here are a few points I can think of...

 

  1. I notice you have turned off software monitoring.  Most likely that is interfering with some of the external inst plugin's compensation timing.  Just a guess.  Try turning it back on and run your test without any manual midi delay compensations.
  2. In general you want to use software monitoring OFF, only when you are actually playing midi parts..where you need to hear the sound connected as tightly as possible to your fingers.  In that case with it OFF, then you hear it directly from your audio interface as soon as possible before it even hits LPX.  That's what you HEAR, but how it syncs up with what LPX is playing back on other tracks is a seperate issue and can't be compensated by LPX that way.  With software monitoring on, then the sound from your Roland comes in through the external inst plugin and you get automatic latency compensation which should adjust things during playback to be timed where its supposed to be...but...that effects playback...not live playing.....you end up with a little more latency while playing live..the timing should be right...but you have to perform with a bit more latency.  
  3. The way LPX works for audio and instrument tracks, it always looks at all the plugins on the track and calculates how much plugin latency there is, and then plays the regions on each track early by the right amount to compensate for the plugin latency, so the sound will be correctly on time.  So..  if software monitoring is turned on, then it will calculate the latency needed for going out to the roland and back, and playback that track early enough to be correct.  If software monitoring is turned off, I don't know what it would do, since the expectation in that case is not to bring it back to the channel at all.  See what I mean?  
  4. And I wouldn't put it past LPX to treat it differently during playback vs recording.  In other words, if you have software monitoring off, then while recording, it could be that LPX ignores the external latency (thus playing the metronome early), but while playing back, it respects that latency and plays back the midi region early.  I don't know, something like that.

Link to comment
Share on other sites

Hi Dewdman,

 

thanks for your response!

 

1. Software monitoring: I turned it back on, but it makes no difference. Your explanation makes perfect sense -- I guess LPX takes all the software plugins' timings into account when this is checked. But in my case, it makes no difference, and I suspect it might be an issue on the MIDI side or the hardware itself...

 

2. I did not hook the roland up w/ a proper audio interface (i.e. audio jack out -> interface in). Everything's over the roland's USB driver, even audio. But I conducted some tests again playing back the track (midi out -> USB midi in) and listening in on the audio out on the device to rule out any audio latency issues. The problem is still there. So I guess it compensates for audio latency as best as it can, but maybe it cannot account for everything and so there's still a delay.

 

3. This is where I suspect maybe LPX lacks some crucial information to compensate for the delay possibly introduced elsewhere in the system. I tested again using a different MIDI interface (EDIROL UM2EX, CoreMIDI) but the delay is still present (metronome on time, roland late). It's hard to test for a delay without a sequencer (just using a MIDI keyboard -> Roland MIDI in) since a reference to test against like a metronome is missing. 

 

4. Again, no difference (software monitoring on/off) when I record the audio. With no track delay, the recording is just about on time (but audible delay on the MIDI track)

 

What I don't understand is this: I assume LPX does some kind of latency compensation during recording (i.e. pulling notes forward a tiny bit). If it didn't, all notes would be a bit late, and the incoming audio too, which would result in a recording w/ a delay. This is not the case, the delay is negligible. Or my assumption is wrong and there is no compensation, the mismatch is introduced in the audio chain somewhere. But then, why is there an audible delay even on the hardware device's audio outputs while playing MIDI? I just dont get it...

Link to comment
Share on other sites

Don't know if this helps, but have you tried recording from a bus rather than directly from an input ? I believe that when you record from an input, Logic is compensating for the output latency, (you hear the music late, so it puts your recording a little bit early). If you record from an aux/bus instead, this doesn't seem to happen. Try creating an aux in your mixer, set the input to the roland and the output to a bus, then create an audio track with that bus as input and record. On my system the aux recording comes in later than the input one.
Link to comment
Share on other sites

Don't know if this helps, but have you tried recording from a bus rather than directly from an input ? I believe that when you record from an input, Logic is compensating for the output latency, (you hear the music late, so it puts your recording a little bit early). If you record from an aux/bus instead, this doesn't seem to happen. Try creating an aux in your mixer, set the input to the roland and the output to a bus, then create an audio track with that bus as input and record. On my system the aux recording comes in later than the input one.

when you have plugins on an aux channel, LPX still does plugin latency compensation, but in that case there is no region it can play early, so what it does is delay all the other tracks relative to the aux channel.  FYI

Link to comment
Share on other sites

Hi Dewdman,

 

thanks for your response!

 

1. Software monitoring: I turned it back on, but it makes no difference. Your explanation makes perfect sense -- I guess LPX takes all the software plugins' timings into account when this is checked. But in my case, it makes no difference, and I suspect it might be an issue on the MIDI side or the hardware itself...

 

2. I did not hook the roland up w/ a proper audio interface (i.e. audio jack out -> interface in). Everything's over the roland's USB driver, even audio. But I conducted some tests again playing back the track (midi out -> USB midi in) and listening in on the audio out on the device to rule out any audio latency issues. The problem is still there. So I guess it compensates for audio latency as best as it can, but maybe it cannot account for everything and so there's still a delay.

 

3. This is where I suspect maybe LPX lacks some crucial information to compensate for the delay possibly introduced elsewhere in the system. I tested again using a different MIDI interface (EDIROL UM2EX, CoreMIDI) but the delay is still present (metronome on time, roland late). It's hard to test for a delay without a sequencer (just using a MIDI keyboard -> Roland MIDI in) since a reference to test against like a metronome is missing. 

 

4. Again, no difference (software monitoring on/off) when I record the audio. With no track delay, the recording is just about on time (but audible delay on the MIDI track)

 

What I don't understand is this: I assume LPX does some kind of latency compensation during recording (i.e. pulling notes forward a tiny bit). If it didn't, all notes would be a bit late, and the incoming audio too, which would result in a recording w/ a delay. This is not the case, the delay is negligible. Or my assumption is wrong and there is no compensation, the mismatch is introduced in the audio chain somewhere. But then, why is there an audible delay even on the hardware device's audio outputs while playing MIDI? I just dont get it...

so another experiment to try is to use an external midi track for your midi and return the audio back from the Roland to a separate audio track.  LPX handles midi timing differently with those tracks then it does for instrument tracks with the external inst plugin.  LPX makes the assumption in that case the user would be listening to the audio through an external mixer with no intention of bringing it back into LPX.  So the midi will not be sent early or anything i don't think.  .  Then you'd have to use the midi track delay to adjust it manually.  But this might be more consistent then the auto compensation.  Its worth a try.

 

Yea something weird is happening.  I wish the external inst plugin had a latency adjustment slider, but it doesn't.  

 

Another question for you, do you have any other audio devices in use or just the Roland USB?  Which audio device is LPX considering as the primary input and output audio device?  auto compensation might be computing wrong because of this?

 

Another thing worth trying if you didn't already is to use the analog audio outs from the Roland coming back into the primary audio device you are using.  and/or make the Roland USB device the primary audio device (preferences->audio).

 

Also in the audio preferences, what is the setting of "recording delay"?

Link to comment
Share on other sites

Don't know if this helps, but have you tried recording from a bus rather than directly from an input ? I believe that when you record from an input, Logic is compensating for the output latency, (you hear the music late, so it puts your recording a little bit early). If you record from an aux/bus instead, this doesn't seem to happen. Try creating an aux in your mixer, set the input to the roland and the output to a bus, then create an audio track with that bus as input and record. On my system the aux recording comes in later than the input one.

when you have plugins on an aux channel, LPX still does plugin latency compensation, but in that case there is no region it can play early, so what it does is delay all the other tracks relative to the aux channel.  FYI

I have no doubt that Logic compensates plugin delay on an aux, I was thinking more of the recording delay compensation, which isn't the same thing...

Link to comment
Share on other sites

yea I see what you mean now...  That is interesting.

 

So will have to use the track midi delay in order to compensate for that to manually force the midi regions to play early, so that they will arrive back to the AUX input on time.  

Exactly -- this is what I did per JakobP's tip. And it worked! :-)

Take a look at the following screenshots. In both cases, the midi track delay on the MIDI track is set at -20ms. The first one shows direct input into an audio track, You can see the "pull" introduced by the compensation. I hope the bar line is sufficently visible.

 

logic_1.png.a3a102b0f76a3f458896aba849c31e3a.png

 

And now, the audio from the device is fed into the bus first:

 

logic_2.png.e595e7edb49bd2b881e8b77e0c9eee1f.png

 

That's what I like to see! :-)

So I think this is a workable solution since it achieves two things (as you already summarised):

- Track midi delay is used to compensate for the playback latency issue

- Aux input is used to disable/circumvent LXP's built-in recording delay compensation

I'll get back after I test your second suggestion (external midi track for the midi).

 

@JakobP, the bus/aux thing is pretty advanced stuff and I'm a beginner :-) Could you take a look at my mixer config and tell me if you see any errors? LXP auto-added one additional aux channel so I'm not sure if this is correct....

 

logic_mixer.png.0cf668bc70af77b722d423bb041dd689.png

Link to comment
Share on other sites

One thing I don't like is you're using a send to go to a bus.  Rather then do that, click on the output button of the aux channel, you will see a bunch of things you can assign the output of the AUX channel to, including a "bus" submenu, where you can select some unused bus to use.  

 

Another advantage of using an external midi track is that you can use various environment objects as the midi output, which will let you create nicer preset lists in LPX, or create mapped midi instruments, multis, etc... which makes working with an external keyboard a little nicer in LPX.  

Link to comment
Share on other sites

Yes, do as Dewdman suggests and remove the send from aux1 and instead set it's output to the bus. Also, you don't need the automatically created aux2, so you can just delete it. Setting it up as in your screenshot, the signal will reach your stereo out from three different channel strips (aux1, aux2 and "bus input"), which isn't optimal. 

EDIT Actually that would be 4 channel strips, since you said you also did set up the audio input in your External instrument. Using an external midi track instead of the external instrument would avoid that, or simply setting the input in the external instrument to the default "blank" again.

Edited by JakobP
Link to comment
Share on other sites

so another experiment to try is to use an external midi track for your midi and return the audio back from the Roland to a separate audio track.  LPX handles midi timing differently with those tracks then it does for instrument tracks with the external inst plugin.  LPX makes the assumption in that case the user would be listening to the audio through an external mixer with no intention of bringing it back into LPX.  So the midi will not be sent early or anything i don't think.  .  Then you'd have to use the midi track delay to adjust it manually.  But this might be more consistent then the auto compensation.  Its worth a try.

 

Yea something weird is happening.  I wish the external inst plugin had a latency adjustment slider, but it doesn't.  

 

Another question for you, do you have any other audio devices in use or just the Roland USB?  Which audio device is LPX considering as the primary input and output audio device?  auto compensation might be computing wrong because of this?

 

Another thing worth trying if you didn't already is to use the analog audio outs from the Roland coming back into the primary audio device you are using.  and/or make the Roland USB device the primary audio device (preferences->audio).

 

Also in the audio preferences, what is the setting of "recording delay"?

Results from the "external midi track" experiment:

1. Recording latency seems to be lower, midi track delay compensation needed is about -5ms to get a good recording

2. At this setting (-5ms), when monitoring the input on the audio track I hear a slight delay, but the recording seems to be ok

So I guess this is the input monitoring latency at work here which is added to the recording latency.

My interpretation: MIDI to device to audio in is about 5ms, audio in to system audio out is about 15ms on top, does that make sense?

 

As to your questions, I just use the Roland USB, nothing else. Primary input is the Roland boutique, primary out is system stereo output (digital) which is connected to an RME ADI-2 D/A converter. Unfortunately, my Macbook Pro lacks a dedicated digital audio in so currently there's no way to feed the converter's A/D output into the MBP. Currently looking into USB interfaces though, things would be so easy if Apple kept the digital in.

Recording delay is set to 0 Samples (default).

Link to comment
Share on other sites

My thoughts...

 

I think your audio card is adding 5ms of latency to get the sound from LPX to your ears.  And I think there is probably 5ms of input latency also for getting the audio into the AUX channel.  The other 15ms I'm not sure, will speculate below...

 

  1. When audio comes in during recording to a normal audio track, LPX assumes there is some input audio card latency, and basically places the recorded audio slightly early onto the track to compensate...EXCEPT when you're using the AUX channel trick you're using now, it should not be doing that compensation.  So with the AUX channel trick, the incoming audio should be recorded to the audio track, let's say 5ms late, whatever the input latency is.
  2. In your case there is an additional potential latency which is related to the time it takes for midi to go out to the Roland, create sound and send back the sound, but its entirely possible that the Roland USB is able to do all of that within less then a ms and so basically you're just getting 5ms of latency there, which corresponds to the 128 sample buffer setting you mentioned.
  3. when you're monitoring the sound through the LPX mixer, then there is at least another 5ms of output latency introduced by the sound card to get the sound to your ears.  
  4. When you set the track delay to -5ms, then that compensates for the input latency and gets the audio recorded to the correct place on the track, however the monitoring of it will sound late due to the 5ms of output latency due to running through the LPX mixer.  You could alternatively turn off software monitoring and I suspect that you would hear it in the correct place and it would be recorded in the correct place.  Just guessing.

what I'm not sure about is why the ext inst plugin version had 20ms of delay while doing it the external midi track way only has 5ms.  If anything I would have expected the other way around.  

 

Also your USB device is sending midi and returning audio in the USB domain, what we don't know is if it is able to avoid some latency somehow in that process.  Your MBP audio card obviously is going to have output latency no matter what.  the audio card setup you have is a little complicated to figure out how its effecting latency or whether LPX can even properly calculate what the latency should be, FWIW.

Link to comment
Share on other sites

Another thing that just occurred to me also is that while external midi tracks do solve some issues and provide the environment objects I mentioned, they do not currently support midi plugins on the track like instrument channels do.  So in some ways if you can get the ext inst plugin to work right, it may be preferable in some cases.  
Link to comment
Share on other sites

Dewdman and JakobP,

 

thanks to both of you for your help! This is a complicated subject and I would still be much more confused if it weren't for you two guys. I learned quite a lot and the picture is clearer now.

 

AUX channel trick: I cleaned up my mixer settings everything is working beautifully now. I couldn't figure out how to choose a different output for the channel but then I accidentally right-clicked and lo and behold there's the chooser! ;-)

 

Latency: I listened in again on the device's audio out while simultaneously listening for the metronome click from LPX (using an awkward mix of two headphones worn at the same time -- yes I need to invest in proper studio gear). I again listened for any delay between the two -- the Roland's click sound and LPX's metronome click. My findings:

 

External MIDI track: 

 

0ms midi track delay compensation: audible delay

-5ms: barely audible delay, pretty spot-on

-10ms: in sync

 

External Instrument plugin:

 

0ms midi track delay compensation: clearly audible delay

-5ms midi track delay compensation: audible delay

-20ms: in sync

 

My conclusion: I guess the external instrument plugin somehow introduces latency. I'm quite happy to find out that using the external midi track the midi out latency (midi track -> midi in -> sound generation -> audio out -> LPX audio in) is quite low, well within 5-10 ms. I suspected this to be the initial culprit, i.e. something wrong w/ the hardware itself, like internal latency in the device possibly due to the ACB digital architecture, which would have been a disaster frankly and possibly a reason to return the unit.

 

So I assume the problem lies in the other part of the audio chain -- and this is where we can only speculate I guess. I too wonder why the instrument plugin latency seems so high.

 

Anyway, I think I have a working solution now. I can either use an external midi track plus an audio track, set the delay on the midi track to an acceptable level, and monitor the hardware, or use the external instrument plugin, with the aforementioned "aux channel trick setup" and manual compensation. You described the pros and cons of each method, so I can pick and choose depending on the situation.

Link to comment
Share on other sites

One other thing to try with external instrument plugin. Even though you are picking up the audio on the aux channel, also enable audio for the ext inst plugin. It might be that it doesn't calculate its own plugin latency properly unless it's receiving audio. Just speculation. But I'd be curious if you bring audio back to both places while sending midi through the plugin, does audio come in at the same place in time on both track?
Link to comment
Share on other sites

  • 1 month later...

Quick update (in case someone is interested): There's been talk lately that the early Boutiques (JU-06, JX-03, JP-08) suffer from internal latency. This could explain a lot of what's going on. See:

 

 

As has been discussed here, the issue can be worked around in a studio setup, but live is another matter entirely...

Link to comment
Share on other sites

Sometimes a diagram can help explain things. These are from "Logic Pro X - The Details" by Edgar Rothermich. I think his docs have been mentioned before elsewhere in the forums. It's interesting to note the choice for an external MIDI instrument where you use both the MIDI channel strip (for MIDI) and an Aux channel strip (for its audio). This is essentially what you setup in DAWs such as Cubase, but I don't see that Cubase gives you the other option(s) Logic does. I forget now what version of Logic added the external instrument plugin, but I think the intent was to make it easier to setup external MIDI instruments.

Delay_Comp.png.b988d1e021067f626c80f4e0686d9d20.png

MIDI_options.png.364b2781d98502165ee1f0b8d4ef4921.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...