Thetis audio glitch discussion

User avatar
w-u-2-o
Posts: 2270
Joined: Fri Mar 10, 2017 1:47 pm

Thetis audio glitch discussion

Postby w-u-2-o » Thu Dec 26, 2019 2:40 am

Referencing the PowerSDR FAQ post here, I've been doing a little work on trying to narrow down the best way to solve this problem with Thetis.

The PC is an i7-7700k overclocked to 5GHz with 32GB of 3200MHz RAM. In other words it's a pretty damn fast machine.

My resampler settings give stable, low latency results, except at startup where I need to poke at VAC a few times to get things going OK. So that's all good to go and not responsible for any audio glitches.

I do see seq errors in the log, but they are an occasional thing, are of a low order (1 to 3 packets missing), and these are not audible, therefore technically not audio glitches, so I don't care so much.

My serious, audible audio glitches come from blocked Thetis process threads. I've pretty much proven this to myself as follows:

1. I load up the CPU to 50% or so by a) running Thetis, b) running OBS for my live radio stream, and c) running a bunch of open tabs in Chrome.
2. Under these conditions I then fire off a LAN speed test session using Tamosoft Throughput Test. I get a steady stream of seq errors in the log from this, but they are of low order (1 to 3 missing packets) and none of these are audible. So it's not a LAN, NIC or IP stack problem.
3. Without Tamosoft running, I load or close complex web pages in Chrome. This causes CPU spikes and BAM!, audible glitches, with corresponding seq errors of a very high order, sometimes even 100's of packets.

I've done the CPU affinity dance with Chrome and Thetis and that does not seem to do the trick.

I've used Task Manager to laboriously set every Chrome process priority (20 or more separate processes!) to "low" priority and that seems to work pretty good!

The question is: can the critical threads in Thetis be identified, and can they be given an appropriate priority such that normal priority threads don't mess with them, thereby eliminating the need to having to either a) manually mess with the priorities of other processes like Chrome or, worse, b) avoiding running other software on the PC while running Thetis?
w9mdb
Posts: 146
Joined: Sun Apr 09, 2017 5:53 pm

Re: Thetis audio glitch discussion

Postby w9mdb » Thu Dec 26, 2019 4:33 am

There's a replacement for Task Manager called Process Hacker with much more capability.
You can set the priority for just one of your browser processes and "remember" it and it will apply forever to all of the browser processes. I set both priority and I/O priority to the lowest possible.
I also set the priority of audiodg.exe to real time and the I/O priority to real time. And the dropouts have decreased dramatically.

https://processhacker.sourceforge.io/downloads.php

de Mike W9MDB
ea3aqr
Posts: 65
Joined: Mon Mar 04, 2019 10:50 pm
Location: BCN

Re: Thetis audio glitch discussion

Postby ea3aqr » Thu Dec 26, 2019 8:55 am

I was having frequent audio glitches on very good PC build:

-AMD Ryzen 3700x 8 cores 16 threads machine (4.2Ghz).
-16 Gb of Ram running at 3600Mhz
-Nvidia 1050Ti GPU
-Very fast Samsung M.2 SSD drive

My PC is powerful enough to run Thetis at just 3 or 4% CPU load on a 2k monitor. So , it was not a problem of a tiny CPU.
I was having random seq errors and packet losses that were audible.

After testing all possible ethernet and PC settings, the solutions was quite easy...

STOP using the Intel gigabyte lan port on my motherboard and start using the Realtek's 2.5Gb one.

Oh my god, it was night and day!. Right now I can run Thetis with any sample rate. My audio buffer size is set at 128, the audio sample rate set at 96000, just a buffer latency of 3/3 and the port audio at 0/0 and I don't have any problem.

Of course there are a few packet drops sometines, but it can't be listen never.

So, in my case, looks like seq errors/paquet loss issues were coming from my Intel lan hardware or drivers.
User avatar
w-u-2-o
Posts: 2270
Joined: Fri Mar 10, 2017 1:47 pm

Re: Thetis audio glitch discussion

Postby w-u-2-o » Thu Dec 26, 2019 11:43 am

Hi Mike,

Before you responded I actually installed the "Prio" extension to the standard Windows task manager. We'll see if that does the trick.

Thanks,

Scott
Bryan W4WMT
Posts: 98
Joined: Sun Apr 09, 2017 10:12 pm

Re: Thetis audio glitch discussion

Postby Bryan W4WMT » Thu Dec 26, 2019 2:04 pm

w-u-2-o wrote:
The question is: can the critical threads in Thetis be identified, and can they be given an appropriate priority such that normal priority threads don't mess with them, thereby eliminating the need to having to either a) manually mess with the priorities of other processes like Chrome or, worse, b) avoiding running other software on the PC while running Thetis?


Hi Scott,

Process Explorer from sysinternals.microsoft.com will show you all the threads running in Thetis along with each thread's priority and context-switching stats. As of v2.6.9 (or maybe 2.6.8, I forget which) Thetis uses Windows' Multi Media Class Scheduler Service to grant the highest possible thread priority (26) to all the stream servicing threads running in the ChannelMaster and WDSP. Also, the ASIO driver for your sound device (if it uses MMCSS) should appear in Thetis' thread list running at priority 26.

It's easy to tell the threads that are doing all the heavy lifting by paying attention to the context switching readouts.

73
User avatar
w-u-2-o
Posts: 2270
Joined: Fri Mar 10, 2017 1:47 pm

Re: Thetis audio glitch discussion

Postby w-u-2-o » Thu Dec 26, 2019 2:23 pm

Thanks, Bryan. So no Thetis thread priority adjustments are required. Nevertheless, apparently the highest thread priority is still not enough to compete with Chrome, which is really surprising.

I have not rebooted yet to see if Prio does what it is supposed to by holding all of the Chrome processes in low priority, but right now setting all Chrome threads to low priority has very little impact on Chrome performance and is solving the glitch problem that Chrome causes.
Bryan W4WMT
Posts: 98
Joined: Sun Apr 09, 2017 10:12 pm

Re: Thetis audio glitch discussion

Postby Bryan W4WMT » Thu Dec 26, 2019 5:22 pm

[quote="w-u-2-o"]Thanks, Bryan. So no Thetis thread priority adjustments are required. Nevertheless, apparently the highest thread priority is still not enough to compete with Chrome, which is really surprising.

Yes, it is surprising. Achieving those highest thread priority levels in Thetis hasn't seemed to help much here either. Does Prio show you the thread priorities running in Thetis? If so, check to make sure the really busy ones are running at priority 26. If not, you may be missing the registry setting that lets MMCSS work. You can google that setting to make sure, but it should already be set by default when Windows 10 was installed.

Windows 10 runs its fancy Aero desktop graphics effects at a very, very high thread priority, but you can turn those off in "Advanced system settings" under the "Performance" group.

73
User avatar
w-u-2-o
Posts: 2270
Joined: Fri Mar 10, 2017 1:47 pm

Re: Thetis audio glitch discussion

Postby w-u-2-o » Thu Dec 26, 2019 5:59 pm

Registry settings are as expected, so that's good. It's tempting to try mucking around with them, but I'm not going to.

Return to “Thetis”