Latency Tip

Why not tell us a little bit about yourself? Welcome to the community!

Moderators: MattKingUSA, khz

latency-fun
Established Member
Posts: 13
Joined: Mon Oct 25, 2021 5:07 am

Latency Tip

Post by latency-fun »

I'm new here.

Just throught I would share what I discovered.. after working with a few different disrubutions for audio for the last several months... (I do online stuff for music/audio instruction)

This might be of help to musicians who do any live playing/recording... needing low latency on small less expensive interfaces.... while using sound emulation/simulation.. without needing the best ad/da on the out.

Duplex it ... Use the interface as the 'in' ONLY (USB/Firewire).. and motherboard audio on the out. Put the interface on it's own bus.

I got a Roland UA-25 to test (was normally.. in the 8ms range without xruns, sometimes 7 - for the time I tested it) .. down to 4ms.

A few xruns.. but not many, running 5-6 Audio applications.. and few videos playing with wifi/browser etc... mid speed proccesor.

This is on the Zen-Arch kernel.

Works great so far - and that was the lowest I got - ... without an expensive interface. Or real time kernel.

4ms is in the range of Lynx/High end-RME etc... the edirol cost 50 used : - )

Repaer reported 4ms ..this is at 3 periods 48k .. some xruns, but no major sound artifacts... I think I had 26 or so after 4-5 hours..

This tip didn't come up on many linux audio sites... so I thought I would share it here.

Thanks for the cool forum!
User avatar
milo
Established Member
Posts: 1242
Joined: Wed Sep 06, 2017 2:55 am
Location: Southern Utah, USA
Has thanked: 275 times
Been thanked: 218 times
Contact:

Re: Latency Tip

Post by milo »

Interesting. I once did that with a Scarlett 2i2 and my experience was not as impressive. But that was years ago and before I really knew how to tune my system. Maybe I'll try it again on my current setup, although I'm currently pretty happy with it as is.
WforWoollyMammoth
Established Member
Posts: 118
Joined: Thu Oct 24, 2019 4:32 pm
Has thanked: 3 times
Been thanked: 16 times

Re: Latency Tip

Post by WforWoollyMammoth »

I get only gargle with low frame and buffer rates with an USB interface as the input and the motherboard interface as the output. Tested with RME Babyface and a Yamaha USB mixer / audio interface. It works better the other way around, with the USB interface as the output and the motherboard audio as the input. However, there's nothing gained that way, as the recorded audio is in poor quality and the USB interface residing as the output will add to the total latency with "the extra buffer" that's implemented there on Linux.

By the way, the reported latency values on applications are misleading. USB Audio on Linux has extra latency due to a poor state the usb audio driver has been for several years and in many cases there's 30% more latency than what applications like Cadence or Qjackctl are reporting. You need to do rountrip latency tests to make sure what the actual latency numbers are. The driver is being fixed currently, but I've understood that it's not reliable yet. I think it might be found already on the latest "tuned" kernels like Liquorix, but I'm not sure.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Latency Tip

Post by merlyn »

Hi latency-fun and welcome to the forum.

In my experience I haven't found using a different soundcard for the input and output to be usable. One reason to use the same soundcard for the input and output is to keep the two streams in sync -- so that when overdubbing the software can calculate out the latency.

The whole latency thing seems to be misunderstood (understatement alert).

A lot of 'latency' information is coming from manufacturers and is eh ... marketing horseshit circulating in the Windows world.

I have an RME PCI card and an ICE1712 based PCI card. In terms of pure low latency the ICE1712 is better. It can work with buffer sizes that don't appear in the JACK dropdown, like 4 samples. The RME card has 64 as the minimum buffer size -- I don't know if that's a hardware limitation or what, but that's it, 64 samples. That is well low enough though.

So much for RME's mystic latency aura :)
ladron
Established Member
Posts: 18
Joined: Fri Dec 13, 2019 8:01 pm
Has thanked: 1 time
Been thanked: 8 times
Contact:

Re: Latency Tip

Post by ladron »

As merlyn says, using two interfaces gives you the additional problem that you now have two separate clock signals to keep in sync. There is non-trivial work that the audio system has to do to cope with this. Using a single interface for both input and output is much simpler, and should work better in most situations - particularly if you are looking for a low-latency input/processing/output loop (ie: live audio processing).
latency-fun
Established Member
Posts: 13
Joined: Mon Oct 25, 2021 5:07 am

Re: Latency Tip

Post by latency-fun »

Hey! Thanks for responding... especially if it's more common to find trouble - for anyone who would reads my original post.

I had a different expereince.

All works! .. And better than it did... better than with an expensive interafce. (So far anyway)

I can look for other linux utilities for reporting latency... to double check (any recommendations?).. but -- the latency difference is real too. And reported through a daw.. not sure it's incorrect.. but could be.

People should care about it -- troubles with latency.. cause more problems in digital audio than almost anything.. (thousands of hours of work .. sorting that stuff out for real world gigs - taught me this).

Anyway ....
It works the way I described....- so just wanted to just give a heads up... for anyone looking for a little tighter sound.

...You can also flip the interfaces, like someone mentioned.. but -- highest quality a/d on-the-in when recording.. and then flip it for mixing- highest quality on the out.

For anyone on shoestring budget... worth a try.


_________________________________________________________________-
**Edit -- for anyone who wants to give this a try. A quick run down...

I used Cadence with Pulse. Not Qjack -- Qjack was not working (for me) on several distro's.

Select the in/out interface in pulse config too after login (otherwise it may not work).... and then the usual place in cadence. Duplex - two cards etc.. high priority... patchbay it.... Also be careful.. some distro's drop/rename the audio device on updates.. and you may have to re-select it with a new name.

In cadence, use a pulse bridge & alsa bridge. But don't autostart anything on login.. let it boot up... check/config pulse.. then start the cadence/jack server and bridge it.

This works on a fairly new mobo/AMD combo with an arch kernel ...
Not sure about the newer kernels on other distro's. Some of those gave me terrible audio trouble.

Arch, so far worked. But - plain-ish arch, not a major distro.
Kott
Established Member
Posts: 816
Joined: Thu Mar 21, 2013 12:55 am
Location: Vladivostok
Has thanked: 65 times
Been thanked: 120 times

Re: Latency Tip

Post by Kott »

latency-fun wrote: Fri Oct 29, 2021 5:38 am All works! .. And better than it did... better than with an expensive interafce. (So far anyway)
so you have measurements ?
WforWoollyMammoth
Established Member
Posts: 118
Joined: Thu Oct 24, 2019 4:32 pm
Has thanked: 3 times
Been thanked: 16 times

Re: Latency Tip

Post by WforWoollyMammoth »

Yeah, well. Cheap motherboard sound chips do exhibit less roundtrip latency than expensive USB audio interfaces that rely on the generic USB sound driver found in the stock kernels. I've tested this on multiple systems. The current USB audio driver adds extra latency at the output in order to avoid xruns, and for one reason or another, many of the most popular audio tools on Linux report the latency values in a misleading way. They ignore the output extra latency completely.

I think the biggest problem with your approach, along with the poor audio quality and the potential sync dropouts, is that using the motherboard chip as the output won't suit multitrack productions on DAW projects. You'll get high JACK DSP loads with just a modest amount of tracks and effects involved (or, alternatively, you'll start getting xruns already at low loads). Your Focusrite should allow you to have considerably more overhead. Please, correct me if I'm completely wrong.

(edited).
latency-fun
Established Member
Posts: 13
Joined: Mon Oct 25, 2021 5:07 am

Re: Latency Tip

Post by latency-fun »

I don't know.

Reaper is not a linux only application.

Do *you* know if the round trip latency is reported inaccurately on reaper ? I will check eventually.

The latency reported, feels the same as it states (as a player) or close to it.

So far.. It works better. Sound quality is good.. no dropouts.

Whether or not it would work for a major production? - probably not.. The D/A for real-expensive-mixing needs --- usually the highest quality reproduction when tracking, clock source, low jitter, for recording.. Checking..and/or moving quality tracks. But, that's like working on stuff transferred to major studio's... or for an independent release.. that needs to sound good.. Outside that need... demo work, live work, instruction.. Quality good enough... basically anything that doesn't need a 2-4k pair of studio monitors.. And 3k in room sound design.. (usually a lot more even, unless your good at less)


BUT.. is it really 4ms ?
What do you guys/girls recommend verifying... what programs consistently work (these days) on linux for RTL ?



FYI.. I worked on all the other systems too - windows/osx .. Lots of daw's etc. Live/Recording audio.. Long history of dealing with those troubles too ... they had lots of problems they didn't tell people.

Anyway... - it's working for my purposes... and if I had to guess.. I could mix something on it that sounded decent. But WHO knows.. Not doing that at the moment. Working.... To be honest... what is a marketing gimmick?.. Said in another message.. is this belief that expensive solves the problems.

Really good A/D/A .. Thousands of dollars... in the right room, with the right setup.. With right outboard gear.. With "the right" everything else ... sometimes even sounds bad by the time the mix is done ----- even with really good bands.. (if your talking baout major label quality) and experienced engineers. That's my experience.

And what was it that I learned ? Latency.... Timing issues ... with both hardware and software.. and even the visual representation of what was on the screen vs on the drive (how it displays the bits) .. and the conversion... midi instruments.. Timing.. One plugin can throw 10 tracks out of sync - by thousandths of a second- because the daw's sometimes guesstimate latency... and cause tons of mixing changes... a great track.. may not sound like a great track again -- because of the inconsistency in digital audio ... they hide that... and the mix may never sound right.. because you have to learn to work around all that -- and many people delving into it -- never told the basics.


SOOO TLDR ... It works great for what im using it for.
WforWoollyMammoth
Established Member
Posts: 118
Joined: Thu Oct 24, 2019 4:32 pm
Has thanked: 3 times
Been thanked: 16 times

Re: Latency Tip

Post by WforWoollyMammoth »

latency-fun wrote: Mon Nov 01, 2021 12:57 am I don't know.

Reaper is not a linux only application.

Do *you* know if the round trip latency is reported inaccurately on reaper ? I will check eventually.

The latency reported, feels the same as it states (as a player) or close to it.

So far.. It works better. Sound quality is good.. no dropouts.

Whether or not it would work for a major production? - probably not.. The D/A for real-expensive-mixing needs --- usually the highest quality reproduction when tracking, clock source, low jitter, for recording.. Checking..and/or moving quality tracks. But, that's like working on stuff transferred to major studio's... or for an independent release.. that needs to sound good.. Outside that need... demo work, live work, instruction.. Quality good enough... basically anything that doesn't need a 2-4k pair of studio monitors.. And 3k in room sound design.. (usually a lot more even, unless your good at less)


BUT.. is it really 4ms ?
What do you guys/girls recommend verifying... what programs consistently work (these days) on linux for RTL ?
You should use the jack_iodelay command line application for measuring the roundtrip latency. It's probably already installed on your system (if it's not, just search for it in your repo under jack-tools or something similar).

Some instructions by falkTX:
https://kx.studio/Documentation:Manual:latency

Reaper seems to report the latency values in the following manner: input latency ms. / output latency ms.

The roundtrip latency is supposed to be the sum of those two, but the values reported by applications do not take into account for the additional driver and device latency. Those have to be added to the overall latency figure (which tends to be MUCH higher on Linux than on Win / macOS, especially when using higher frame / buffer rates than 128 / 3 - and the only way to measure them is to use an application like jack_iodelay).

The way you've described your current setup, with the motherboard sound chip used for outputting the audio, makes me think you are actually not suffering from the same kind of drawbacks one would suffer from when using the generic USB driver for the USB device outputting the audio (I also think your Zen Arch kernel might already have the fixed version of the USB driver, but I'm not sure about that). However, I'm not convinced that you are getting the results you're reporting due to the reason that you've specified yourself - i.e. using two sound devices splitting the workload and using their own buses.

As Reaper reports the input and the output latency separately, I'm under the impression the first number would be for your USB device used as the input and the second number for the motherboard sound chip. What type of values does it state in the top bar on the left?

(pardon - I've referred to your USB interface in my earlier post as a "Focusrite" unit, but apparently it should have read "Roland")
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Latency Tip

Post by merlyn »

latency-fun wrote: Mon Nov 01, 2021 12:57 am ... what is a marketing gimmick?.. Said in another message.. is this belief that expensive solves the problems.
Yes, I would say so. I quite like making fun of Windows so ...

Let's take ASIO. Audio Streaming Input Output. Hmmm. That sounds like a soundcard driver to me. What's the alternative? Audio Buffering Input Output?

Yes, that's what the Windows audio subsystem was like before ASIO. Steinberg took one look at the Windows audio subsystem and re-wrote it from scratch. (My Windows using friends hate it when I say that :))

Misinformation works best when it's mixed in with a bit of truth so RME do actually have the lowest latency USB interfaces on Windows. And I don't think that's because their drivers are great -- their drivers are drivers and the other manufacturers have things that are kind of like drivers, but aren't. However in the Windows audio world people bow down at the shrine of RME drivers.

Totally different story on Linux. Every USB interface uses the same driver. So the idea that interface A is faster than interface B doesn't apply.

There is a bit more to it. In addition to the latency introduced by the buffer inside the computer there is latency introduced by the hardware, which software doesn't report. There is a (small) hardware buffer and a propagation delay through the A/D and D/A convertors. That needs to be measured by connecting an input to an output with a physical cable and using jack_iodelay or the LSP latency meter plugin.
WforWoollyMammoth
Established Member
Posts: 118
Joined: Thu Oct 24, 2019 4:32 pm
Has thanked: 3 times
Been thanked: 16 times

Re: Latency Tip

Post by WforWoollyMammoth »

merlyn wrote: Mon Nov 01, 2021 12:37 pm Totally different story on Linux. Every USB interface uses the same driver. So the idea that interface A is faster than interface B doesn't apply.
I've noted slight differences between the two USB interfaces I own (RME Babyface Pro and a Yamaha mixer with a built-in interface). It might be due to the hardware differences though.
merlyn wrote: Mon Nov 01, 2021 12:37 pm There is a bit more to it. In addition to the latency introduced by the buffer inside the computer there is latency introduced by the hardware, which software doesn't report. There is a (small) hardware buffer and a propagation delay through the A/D and D/A convertors. That needs to be measured by connecting an input to an output with a physical cable and using jack_iodelay or the LSP latency meter plugin.
Linux audio software also fails to report the shortcomings of the USB audio driver, which by nature is software. The latency values when using USB devices can also vary quite a bit with each start of the audio system, which goes unreported by applications in a similar manner.

I don't know why it goes unnoticed by so many people. My first guess is that they might "feel that something's wrong" with their systems when they use software monitoring while playing an instrument, but they just won't bother to do the roundtrip latency tests.
merlyn
Established Member
Posts: 1392
Joined: Thu Oct 11, 2018 4:13 pm
Has thanked: 168 times
Been thanked: 247 times

Re: Latency Tip

Post by merlyn »

WforWoollyMammoth wrote: Mon Nov 01, 2021 2:00 pm I've noted slight differences between the two USB interfaces I own (RME Babyface Pro and a Yamaha mixer with a built-in interface). It might be due to the hardware differences though.
Are they both USB 2? My friend has a Yamaha mixer that is USB 1.1, and USB1.1 does have worse latency. USB audio uses isochronous transfer. In USB 1.1 one packet is sent per millisecond, in USB 2 eight packets are sent per millisecond, so the diference would be around 2ms.

If you're using JACK you can shave one period off the buffer by using JACK in 'server synchronous' mode.

I'll be interested to hear about your results when you get a kernel with the fixed USB module. Hopefully the latency will be noticeably better.
latency-fun
Established Member
Posts: 13
Joined: Mon Oct 25, 2021 5:07 am

Re: Latency Tip

Post by latency-fun »

Hey - Just read the replies -- if I get around to it this weekend... will try jack_io/delay (thanks for the suggestion) .Wanted to check what was working for others..

As far as reaper.... it shows a single round trip on the version i'm looking at --- There isn't a in/out latency .. it's the 'round trip' reported.. as 4ms.

It's a newer kernel--- i'm using though -options could of changed on that version of repaer too. I can double check that..

The playability -- I have hundreds (probably thousands?) of hours recording live instruments with emulation.....(if you doubled what reaper reports, that would be -- 8ms).......8ms sucks - for hi-z inst and serious recording, doesnt feel like 8ms from all the other systems I used (which were many).................... it feels close to what it reports. If it isn't I will be suprised.


When I have a couple hours, I will try the in/out jack delay.... the reason I asked though --- like others using Qjack -- Qjack isn't working for a bunch of people -- but still recommended everywhere. Cadence works without any trouble. Sooo just double checking....

Good info on the replies - Thanks!



EDIT EDIT EDIT -------- after thinking about all these responses.....

***EDIT - Also -- putting the USB on a separate bus DOES work, contrary to one of the replies. Works consistently.. Vs xruns and a little extra latency - when on a bus with several other usb components. When done this way. Nothing else on the bus.

Every session is now 0-1 xrun, sometimes even none after 4-5 hours.

BUT - You have to separate the devices by 2.0 and 3.0 for each root bus. SOO.. if you have 2 root buses and each has a 2.0 & 3.0 ... leave one 2.0 root bus for JUST for the usb interface (unless it's 3.0 interface), This choice has been consistent, while working.... sooo separate 2.0 bus works.

--------

I hope none of these replies are fake.. Here on linuxmusicians... I know companies are hiring people to confuse consumers about competing products/options (even when free)... Lots of money these days... in fake accounts, replies/social engineering/forums.. Record labels, promotion companies, paid for reviews.. Social media.. It's been going on for 10+ years. It's disgusting.

I find it strange that almost all replies on here.. are to the contrary .. Of something, I wrote - while all is working ... and each part I wrote about, made it work better.... Anyway - Enjoy, if it works for you.. that's why I posted the tip.

I also owned thousands of dollars of RME too.. Expensive. These companies may or may not want people to be able to enjoy more for less. Try the Arch kernel too - if anyone is reading this... worked better than every other distro for audio... on several systems .. this last year... for me.

Anyone remember the NSA paying for backdoors in encryption - even for (inter)national standards/RISA? Or BSD - FBI paid developer for backdoor (well that was the claim by the FBI, and one was found)..... There may be stuff going on... in linux communities too.. By competing developers... and product manufacturers... people being hired in open source communities.

Hopefully not -- but seeing all these responses -- all claiming something about what im doing, doesn't work right for audio... is strange.... Makes the antennae tingle a little...

Could companies be employing people to confuse people interested in linux audio/music..?

Anyway read the first tip... it's an easy read. And an easy thing to try!
User avatar
milo
Established Member
Posts: 1242
Joined: Wed Sep 06, 2017 2:55 am
Location: Southern Utah, USA
Has thanked: 275 times
Been thanked: 218 times
Contact:

Re: Latency Tip

Post by milo »

latency-fun wrote: Sat Nov 13, 2021 11:46 pm I hope none of these replies are fake.. Here on linuxmusicians... I know companies are hiring people to confuse consumers about competing products/options (even when free)... Lots of money these days... in fake accounts, replies/social engineering/forums.. Record labels, promotion companies, paid for reviews.. Social media.. It's been going on for 10+ years. It's disgusting.
Nope! I'm the real deal! And what I wrote was just my own experience.

But I agree that such manipulation is disgusting.
Post Reply