Page 1 of 2

Round-trip latency of USB Audio is not stable

Posted: Wed Dec 21, 2016 12:08 pm
by xmosfan
Hello.
I'm checking the round-trip latency of USB Audio with XK-AUDIO-216-MC and PC (Windows 7 Pro SP1).
I added loop-back to the mixer module of XMOS FW - USB Audio 2.0 Device Software Ver.6.12.5, and measured interval between USB Audio Out and In.
I used Thesycon USB ASIO Driver Ver.3.34. Following is the setting of TUSBAudio Control Panel and round-trip latency (USB Audio Out - In) and total latency of application at 44100Hz sample rate.

<Sample Rate: 44100Hz, USB Streaming Mode: Minimum Latency, ASIO Buffer Size: Auto>
USB Audio Out - IN: 498us
Total Latency of App: 273samples

I tried about 10 times, the results were stable - 498us. Then, I changed sample rate like following, and measured again.

44100Hz => 48000Hz => 44100Hz

<Sample Rate: 44100Hz, USB Streaming Mode: Minimum Latency, ASIO Buffer Size: Auto>
USB Audio Out - IN: 373us
Total Latency of App: 267samples

I tried about 10 times, the results were stable - 373us.
It seems that this change is occurred by reopening USB Audio stream and changing sample rate.

Why is the round-trip latency in XMOS changed? Host PC shouldn't affect this latency.
I changed the USB Streaming Mode of TUSBAudio Control Panel to Extra Safe.

<Sample Rate: 44100Hz, USB Streaming Mode: Extra Safe, ASIO Buffer Size: Auto>
USB Audio Out - IN: 498us
Total Latency of App: 5869samples

44100Hz => 48000Hz => 44100Hz

<Sample Rate: 44100Hz, USB Streaming Mode: Extra Safe, ASIO Buffer Size: Auto>
USB Audio Out - IN: 373us
Total Latency of App: 5862samples

Difference of the round-trip latency (USB Audio Out - In) is 125us (=5.5125samples at 44100Hz).
Difference of the total latency of application is 6 or 7 samples.
They are nearly equal. I would like to the round-trip latency be stable.
I added zip file which include png files of USB log.

Thank you in advance.

Re: Round-trip latency of USB Audio is not stable

Posted: Wed Jan 18, 2017 11:31 am
by Ross
This could well be due to underflow checks not properly accounting for different packet sizes in async mode. Have you tried the latest FW version?

Re: Round-trip latency of USB Audio is not stable

Posted: Thu Mar 30, 2017 3:53 am
by xmosfan
Sorry for late to reply. No, I have not yet. Because I use patch file - decouple.xc which improve latency. It does not work with 6.15.2. If you want to know about the detail of patch file, please contact to me directly.
I tried to use the latest FW 6.15.2 with Explicit Feedback and not improved latency.

----------------------
1st trial
----------------------
<Sample Rate: 44100Hz, USB Streaming Mode: Minimum Latency, ASIO Buffer Size: Auto>
USB Audio Out - In: 3497us
Total Latency of App: 405 samples

44.1kHz -> 48kHz -> 44.1kHz

<Sample Rate: 44100Hz, USB Streaming Mode: Minimum Latency, ASIO Buffer Size: Auto>
USB Audio Out - In: 3377us
Total Latency of App: 401 samples

Difference of the round-trip latency (USB Audio Out - In) is 120us (=5.292samples at 44100Hz).
Difference of the total latency of application is 4 samples.

----------------------
2nd trial
----------------------
<Sample Rate: 44100Hz, USB Streaming Mode: Minimum Latency, ASIO Buffer Size: Auto>
USB Audio Out - In: 4252us
Total Latency of App: 437 samples

44.1kHz -> 48kHz -> 44.1kHz

<Sample Rate: 44100Hz, USB Streaming Mode: Minimum Latency, ASIO Buffer Size: Auto>
USB Audio Out - In: 4627us
Total Latency of App: 454sample

Difference of the round-trip latency (USB Audio Out - In) is 375us (=16.5375samples at 44100Hz).
Difference of the total latency of application is 17 samples.

In conclusion, it seems that the fluctuation of round-trip latency is related to the internal latency of XMOS.
DAW needs the information of stable latency value from the audio device via ASIO driver. But I can't define the value by this problem.
Please give me some advice.

Re: Round-trip latency of USB Audio is not stable

Posted: Thu Mar 30, 2017 5:08 am
by xmosfan
xmosfan wrote: I tried to use the latest FW 6.15.2 with Explicit Feedback and not improved latency.
I checked USB log with above FW. Even though `UAC_FORCE_FEEDBACK_EP' is defined, I couldn't see the transaction of EP1 IN for Explicit Feedback. (I confirmed that EP1 IN exists in Endpoint Descriptor.)
Then, I checked USB log with 6.12.5. There is no transaction of EP1 IN, too.
Under the emvironment - Windows and Thesycon driver, does Explicit Feedback work properly? I don't know there is relation between unstable round-trip latnecy and this symptom whether or not.

Re: Round-trip latency of USB Audio is not stable

Posted: Tue Jun 06, 2017 4:08 pm
by Unchyu2
Hello,

We are experiencing the same issue, have you had any luck in stabilizing the round-trip latency?

I can add that we have tested this and we have observed the same inconsistency both on Windows 10 using CEntrance ASIO Latency Test Utility and on Linux using jack_iodelay toolkit.
We have also tested this with two development boards: xCORE-200 Multichannel Audio Platform and xCORE-200 sliceKIT.

Is is something in the USB AUDIO 2.0 firmware that we can change in order to solve this?

Thank you in advance,
Ilie

Re: Round-trip latency of USB Audio is not stable

Posted: Wed Jun 07, 2017 2:46 am
by xmosfan
Unchyu2 wrote: We are experiencing the same issue, have you had any luck in stabilizing the round-trip latency?
No. I could not find the way to stabilize the latency.
I guess that XMOS has fluctuation of latency. At least, it is a few micro frame (n x 125us).

Re: Round-trip latency of USB Audio is not stable

Posted: Wed Jun 07, 2017 10:30 am
by Unchyu2
Thank you for your reply.

Re: Round-trip latency of USB Audio is not stable

Posted: Wed Feb 21, 2018 1:53 pm
by Jokke
Hey
We are having the same issues, any news?

Re: Round-trip latency of USB Audio is not stable

Posted: Thu Feb 22, 2018 1:20 am
by xmosfan
Jokke wrote:Hey
We are having the same issues, any news?
No. I have decided the Terminal Latency value in the descriptor by the first measurement.
1. Connect to PC
2. Select driver setting
3. Measure Latency

Re: Round-trip latency of USB Audio is not stable

Posted: Thu Feb 22, 2018 12:39 pm
by Ross
Unchyu2 wrote: I checked USB log with above FW. Even though `UAC_FORCE_FEEDBACK_EP' is defined, I couldn't see the transaction of EP1 IN for Explicit Feedback. (I confirmed that EP1 IN exists in Endpoint Descriptor.)
Then, I checked USB log with 6.12.5. There is no transaction of EP1 IN, too.
Under the emvironment - Windows and Thesycon driver, does Explicit Feedback work properly? I don't know there is relation between unstable round-trip latnecy and this symptom whether or not.
The Thesycon driver implementation ignores the feedback pipe and always uses the input stream when available. You should see it use it for and output only device.