External Instrument Plugin

Hi all,

I want to set up my Ardour 6.7-2 on Manjaro as a hybrid DAW with software and hardware instruments.

For using external effects units, I know there is an “External Send” function, although I haven’t used it yet.

Is there something similar for routing midi and audio to and from my external synthesizers, taking latency compensation into account?

The IO side I could do with separate MIDI and audio channels, but then how do I deal with the different latency compensation for different hardware routings?

Any ideas would be appreciated!

Thanks a lot!

No. This case is MIDI out, Audio in. So it’s not a simple send/return pair as for audio. You need different track or bus types.

So you create a MIDI track without synth-plugin, then send that track’s MIDI output to the synth, and record the synth’s audio onto a different track, just like any other incoming audio.

Hello Robin,

thank you for your answer.

That’s exactly how I just configured it. Now when I play the midi track and route the audio tracks from the external instrument into the mix, I have an offset.

In the audio/midi setup I have both audio and midi latency calculated by Ardour.

How do I get rid of this latency? Can I configure an individual latency per audio and/or midi track?

What am I doing wrong? Any ideas are welcome!

The problem with that Ardour measures round-trip

Ardour → soundcard OUT → cable → soundcard IN → Ardour

and evenly divides the result to IN + OUT. In reality however it is not always symmetric (in some cases systemic capture latency is larger).

This works fine when recording audio-overdubs where it doesn’t matter (replace “cable” with “headphone + singer”), there’s no effective difference between capture and playback latency as long as the sum is correct.

But in your case it does matter because you only use one half: the “IN”, and likewise for MIDI only the systemic playback latency matters.

No. The value isn’t per track anyway, but related to your hardware.

In Ardour’s Audio/MIDI Setup, try re-distributing the measured systemic latency: increase “Hardware Input latency” and reduce “Hardware output latency” by the same amount. (assuming the audio comes back too late).

PS. Are you using the same soundcard for both audio i/O and MIDI I/O? What device is that?

I have measured this the past using a UA-25 for audio and MIDI, then connected MIDI-out to Audio-in (tap off raw MIDI signal)

When I record the looped back MIDI data as audio in Ardour this aligns perfectly with this device, when evenly distributing systemic latencies. – So at least for this device it works OOTB without manually tweaking alignment.

Hi Robin,

wow - thank you very much for the extensive and detailed answer!

Hmm, okay. I assume by “hardware” you are referring to my sound card, right?

But my various vintage gear also still each have their own latency from the input of the midi signal to the sound synthesis to the output of the audio signal. This is definitely not dependent on my sound card. How do I get a handle on this if I can’t control the latency compensation individually per external device?

Okay, thanks, I’ll try that next time I’m in the studio. And your assumption is correct: the audio signal arrives late in Ardour.

I will also try it out for different vintage gear to see if this works sufficiently accurately with a single value of the re-distributed systemic latency compensation. Unfortunately, I have no idea yet if the individual devices really have different latencies - but I strongly suspect that they do.

I use my MOTU 828es - in USB vendor mode with the Drumfix driver and kernel patch - for both midi and audio at the same time. So I could probably use the midi to audio trick you suggested to measure latency. How did you build this midi to audio adapter? I’m not good at soldering at all :upside_down_face:

And do I understand correctly that you first measured the latency of audio and midi in Ardour and then play the midi signal and record it as audio (via the crazy adapter) and that’s in sync?

So that would be proof that vintage gear introduces its own latency, right? Then the question would remain: how could I compensate for that?

My response above was a mild lie, While you can not directly control this in Ardour, you can trick Ardour by adding a plugin that serves as artificial latency. e.g “Micro Delay Line” (from x42-plugins with a negative delay), there is also a plugin aptly called “artificial latency” plugin from SWH available as LV1 and LV2.

It’s not trivial to set this up though: You have to use a custom recorder position (processor box context menu > Disk I/O), and then add the artificial latency before the recorder.

image

You will also have to disconnect the output of the track (otherwise all other tracks will be delayed to line up).

1 Like

Hi Robin,

thanks again for your great answer!

It sounds a bit complicated but I will try it out. In the end all what matters is that I get my external instruments synced with the virtual instrument in the box :smiley:

Just to satisfy my curiosity, for Ableton Live there is a plug-in that seems to greatly simplify the integration of external instruments (Using hardware synthesizers with Live – Ableton).

Would such a plug-in also be possible for Ardour?

1 Like

I have been struggling with the same problem for a while. Prefixing the audio track with a negative delay is a good idea, but it creates new problems because the signal can’t be processed through other busses.

Is it possible to apply a negative delay directly to the midi track?

Is this something you are hearing that you want to address, or just a theoretical problem that you want to understand?
Most hardware synthesizers should have in the single to low double digit milliseconds.
This paper measures a few and found that different sounds had different latency between MIDI in and audio out on the same hardware, so it isn’t necessarily even a single setting per device, but specific to the patch you choose on a particular device.
See table 3 and figure 7 here:
MIDI benchmarking paper by Schulz

My understanding is that latency of up to a few ms is not objectionable if constant, a performer will naturally compensate, but large swings in latency will throw you off. Swings in latency cannot be compensated for in the recording software, so you end up with a situation that what you can compensate doesn’t affect much, and what has bad effect can’t be compensated.

Hi Chris,

thank you very much for this amazing thesis paper!

I have only briefly skimmed it and am really flashed. I also find your explanations very interesting. Many thanks for it.

So far I haven’t really thought about the intrinsic latency of my vintage gear. Only through my question and your answers here in the forum, I started to understand the issue better and better.

What I am currently hearing (and my initial question was exactly about this) is that I am sending a midi signal from Ardour via the sound card to an external sound generator and its audio output, routed via the same sound card as the midi signal, arrives in Ardour delayed (even though I have had Ardour calculate the midi and audio latency).

So I definitely hear latency in the whole chain, but I suspect from Robin’s statement that this is mainly due to the asymmetric real latency between signal input and output, since I “only” use the midi output and the audio input in my signal chain. Whereby the latency value measured by Ardour is simply distributed half and half to input and output.

I don’t hear the inherent latency of my vintage gear yet, and if I look at the numbers in the fascinating paper, I will probably never be able to hear it, and even if I could, according to your statement there would be no technical way to compensate for this latency. At least not on a per device basis.

Please excuse my repetitions, but I’m just trying to explain it to myself again :upside_down_face:

Hopefully this weekend I’ll get around to trying out what I’ve learned from you here - I’m extremely excited to see the results…

It is always good to learn and increase your knowledge. Just remember that people used sequencers driving MIDI synthesizers for many years before there were recorders that could adjust for latency, so adjust it a little bit, then at some point you have to say this is a lot better than anyone had in the 1980’s and even most of the 1990’s, so time to stop tweaking settings and get to recording.

Hi synthesis, Robin, Chris and all :slightly_smiling_face:

now I had some time to experiment with the latency compensation settings.

When playing around with different audio input and output latency compensations the results were not satisfying in my opinion.

image

So I kept the audio latency compensation determined by Ardour at 99 samples each.

And what can I say? The midi latency compensation has now solved it best, so far!

I have three drum tracks here, all hitting at the same time at the beginning of each bar (aka four-to-the-floor): the first is my Akai XR10 external drum computer, the second is a Geonkick virtual instrument, and the third is the rhythm section of my Roland D110 vintage synth.

The lowest audio recording track in each case is recorded with the audio and midi latency compensation settings calculated by Ardour. The upper one with unchanged audio latency compensation and my own midi latency compensation settings. This did the trick.

The 160 samples of systemic input latency was calculated by Ardour. I only increased the output latency.

Even though I have now achieved the desired result, I am not quite sure if this was the right way to achieve the goal :grinning_face_with_smiling_eyes:

Any suggestions or hints on this?

P.S.: For the very attentive: the offset in the two Geonkick audio tracks comes from the fact that I adjusted the midi event of all three tracks after the first recording, because Geonkick played too early.

1 Like