[LAU] reducing xruns (System configuration)

Will Godfrey willgodfrey at musically.me.uk
Wed Jul 18 23:20:02 CEST 2018


On Wed, 18 Jul 2018 14:57:32 -0500
"Chris Caudle" <chris at chriscaudle.org> wrote:

>On Wed, July 18, 2018 2:28 pm, Max wrote:
>> 64 buffer size at 48kHz 2 Periods/Buffer  
>
>That is low for USB devices. Not all USB devices can run reliably at that
>low latency (around 1.3ms).
>First try 3 periods/buffer, because of quirks regarding how buffers get
>split into USB packets that can sometimes work more reliably.
>Doubling the buffer size is still only around 2.7 ms, that is usually low
>enough
>
>Regarding the WiFi driver problem, I have never seen any documentation
>that suggests someone has fully debugged the cause, but it seems to be
>some drivers searching for wireless networks in interrupt context, or
>something similar which disrupts the scheduler.  I am not sure if that
>still causes a problem with a fully RT patched kernel or not.
>

Something nobody seems to have mentioned is the command lsusb.
This will show you what is hanging on which bus. Ideally you want to try
different sockets until you find one that has nothing else on it.

Here is my 'office' one for example:

will at debian:~$ lsusb
Bus 005 Device 002: ID 8087:8000 Intel Corp. 
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 004 Device 003: ID 17cc:1001 Native Instruments 
Bus 004 Device 002: ID 0227:0227  
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 003: ID 04d9:1603 Holtek Semiconductor, Inc. Keyboard
Bus 002 Device 002: ID 046d:c018 Logitech, Inc. Optical Wheel Mouse
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

You'll see the NI KA6 is entirely on its own.

I don't know the sound card you are using, or how old it is, or even how well
it's firmware supports USB2, but USB2 speeds on modern cards can easily manage
64/2 at 48k. Indeed, mine can (just) manage 16/2 at 48k.

With a modern computer, supporting USB2 *high* speed you can get an effective
data rate very much faster than 1mS.

An except from:
https://www.edn.com/design/consumer/4376143/Fundamentals-of-USB-Audio

---------------------------------

A single isochronous transfer can carry 1024 bytes, and can carry at most 256
samples (at 24/32 bits). This means that a single isochronous endpoint can
transfer 42 channels at 48 kHz, or 10 channels at 192 kHz (assuming that High
Speed USB is used - Full Speed USB cannot carry more than a single stereo IN
and OUT pair at 48 kHz).

When transmitting digital audio, latency is introduced. In the case of High
Speed USB this latency is 250 us. A packet of data is transferred once in every
125 us window, but given that it may be sent anytime in this window a 250 us
buffer is required. On top of this 250 us delay, extra delay may be incurred in
the O/S driver, and in the CODEC. Note that Full Speed USB has a much higher
intrinsic latency of 2 ms, as data is only sent once in every 1 ms window.

---------------------------------

-- 
Will J Godfrey
http://www.musically.me.uk
Say you have a poem and I have a tune.
Exchange them and we can both have a poem, a tune, and a song.


More information about the Linux-audio-user mailing list