Resampler Adjustment

User avatar
W2PA
Posts: 166
Joined: Sun Apr 09, 2017 6:34 pm
Location: LaGrangeville, NY
Contact:

Re: Resampler Adjustment

Postby W2PA » Sun May 24, 2020 8:15 pm

Hi Scott,

Observant question! I should have explained more details.

It wasn't in FT8 mode - it was in Freq Cal mode in DIGU, VAC on (of course). But since I had been previously operating FT-8, the remnants of my previous QSO were still in the entry slots.

I'm holding out hope that some combination of settings might make this difference disappear. Your results give me hope that might be possible. More experiments needed. Maybe I'll get back to it for a while tomorrow.
73,
Chris, W2PA
User avatar
w-u-2-o
Posts: 5539
Joined: Fri Mar 10, 2017 1:47 pm

Re: Resampler Adjustment

Postby w-u-2-o » Sun May 24, 2020 8:56 pm

I'm sorry, Chris, but that doesn't match the behavior of WSJT-X here. In frequency calibration mode the controls and displays look like those shown in my screen shots. Your controls and display look like those when you are in FT8 mode. Something's not right...
N8UR
Posts: 7
Joined: Fri Dec 28, 2018 6:59 pm

Re: Resampler Adjustment

Postby N8UR » Mon Jun 08, 2020 7:34 pm

A while ago I posted a topic about "ghost" decodes I was seeing on FT-8 with WSJT-X (see viewtopic.php?f=6&t=3431&p=11398#p11398).

Today, I was finally able to pin down the cause, and it is the rational resampler. Attached is a shot of the WSJT-X waterfall showing an S9ish unmodulated carrier. At the bottom the rational resampler was turned off. A couple of minutes later, I turned the resampler on and you can see first an immediate frequency jump followed by a long period of wander while the resampler settles down. You can also see the strong 100 Hz spurs that appear at the same time. After 10 or more minutes, the resampler seems to stabilize and at that point the spurs go away -- though anecdotally I've noticed that CPU load or temperature changes can cause another period of resampler "hunting" and accompanying ghost decodes. (I turned the resampler off shortly before the end of the run; you can see the small noise burst near the top when that happened.)

I don't know what is causing the 100 Hz spurs, but they are certainly tied to the resampler's action. They are related to the strength of the signals in the passband; with an S5 signal the spurs were noticeable only for the first minute or two after the resampler was turned on; with a stronger signal, they were there as shown in the attachment.

At this point I haven't tried the various resampler options to see if they resolve the problem; it may just be that in my case leaving the resampler off is the best answer, as I don't see glitches. I'm just happy knowing where the ghosts were coming from, and that I can eliminate them!
Attachments
rational_resampler_1.png
rational_resampler_1.png (898.84 KiB) Viewed 21546 times
K9RX
Posts: 414
Joined: Fri Apr 14, 2017 3:47 pm

Re: Resampler Adjustment

Postby K9RX » Tue Jun 09, 2020 12:09 pm

Seems a reasonable conclusion you've come to ...

I've not bothered with the resampler for a long long time. Just don't mess with it. Seems almost a solution looking for a problem. Since perturbations in CPU action elsewhere cause clicks and jumps in the TX signal - and since these also induce the resampler to 'start anew' it just seemed fruitless. I've had very good success since I've stopped obsessing over it and setting the affinity. Still have jumps occasionally.

I swear one update from Microsoft maybe a few months ago improved that situation - as if they finally recognized that THEY are causing havoc to programs at times by poor core management ... note I mention TX and you're here focusing on RX ... but I believe they're one in the same.

did you try just not using it at all? Apologies if you mention that earlier on. I know I'm comparing apples to different apples somewhat as I am still using 3.4.9 and not Thetis which you are - but I believe the outcomes are the same. I see mention of setting "FORCE" using Thetis so not sure there's been any overall improvement in the action of the resampler.

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

Re: Resampler Adjustment

Postby w-u-2-o » Tue Jun 09, 2020 4:27 pm

Just a minor point of clarification: it is the "variable resampler" not the "rational resampler". This capability was first released in PowerSDR 3.4.8:

https://apache-labs.com/community/viewtopic.php?f=6&t=2763&p=5184&hilit=variable+resampler#p5184

In contrast to Gary's experience, I've found that using the resampler substantially improves (decreases) the number and severity of the audio artifacts (glitches, etc.) that I notice. And, if you look at my earlier posts in this topic, I do not observe any significant instability in the resampling rate, i.e. the signals are rock solid in WSJT-X et al.

Obviously if you are getting the performance you want with the resampler disabled then perhaps there is no point in trying to get it to work better. However, I'd suggest trying to pare down your VAC buffer size and VAC buffer latency settings (both RingBuffer and PortAudio) to the minimum that provides you with reliable VAC audio. This may improve resampler performance for you.

The only problem I have experienced with the resampler is that it will periodically go unstable on me, particularly when starting Thetis. To reset the resampler I will uncheck and recheck the "Manual" checkbox on Ringbuffer In setting. Sometimes it takes a few tries to get it stable again. By "stable" I mean that all over and under-flow counters have stopped counting. If you see them counting then your resampler is not stable and you will definitely get poor results under those conditions.

73,

Scott
K1LSB
Posts: 639
Joined: Wed Feb 05, 2020 5:25 pm

Re: Resampler Adjustment

Postby K1LSB » Tue Jun 09, 2020 6:13 pm

w-u-2-o wrote:The only problem I have experienced with the resampler is that it will periodically go unstable on me, particularly when starting Thetis.

Scott,

What is a "resampler", and why can't I find it in the Thetis software or documentation (I've always been a Thetis user)? Why is it called that, what does it do, how does it work, etc?

The definition and/or operating theory of a resampler has heretofore evaded all of my efforts to find. I was under the assumption that there is no resampler in Thetis but your statement forces me to abandon that assumption.

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

Re: Resampler Adjustment

Postby w-u-2-o » Tue Jun 09, 2020 7:37 pm

Mark,

Did you read the link I posted above? If not, please do that and let us know if that answers your questions.

73,

Scott
K1LSB
Posts: 639
Joined: Wed Feb 05, 2020 5:25 pm

Re: Resampler Adjustment

Postby K1LSB » Tue Jun 09, 2020 8:21 pm

Scott,

I've read that post before.

1) The post is specifically about PowerSDR, not Thetis. The post speaks of "Resampler" checkbox in Setup > Audio > VAC1" but I see no such checkbox in Thetis.

2) It also speaks of a "diagnostic display" but I can't find that either.

3) It speaks of setting the "primary buffer size" and "VAC buffer size" but I can't find either of those defined or designated anywhere.

4) It also says that "the smallest possible ringbuffer on the receive side is 512, the smallest on the transmit side is 1024", but both default ringbuffer sizes on my screen (mine are labeled "In' and "Out" ringbuffers, not "Receive" and "Transmit") are 120, much smaller than either of the numbers noted in the post.

So the post you linked to is more confusing than enlightening, at least to me.

Regardless, I'm still not clear on exactly what a resampler is, or whether it's optional or not (can be enabled/disabled at will), or whether it's even recommended or not, or how it's used in Thetis.

I ask mainly because of your previous statement specifically mentioning the existence of a resampler in Thetis.
User avatar
w-u-2-o
Posts: 5539
Joined: Fri Mar 10, 2017 1:47 pm

Re: Resampler Adjustment

Postby w-u-2-o » Tue Jun 09, 2020 10:11 pm

K1LSB wrote:Scott,

I've read that post before.

1) The post is specifically about PowerSDR, not Thetis.


I had hoped you could make the leap between the two programs, but apparently not. The resampler is the same in both programs and performs the same functions for the same reasons, which are (quoted from the link above):

"Adaptive Variable Resampler:

This release of PowerSDR mRX (and in the equivalent Thetis release) introduces an optional Adaptive Variable Resampler option for VAC audio. The implementation is a true resampler and not just a data "smoother".

Since both the radio and the PC use different clocks to obtain their nominal 48KHz audio sampling rate, the rate in the radio will not exactly match the rate in the PC. This sample rate mismatch leads inevitably to audio buffer under- and over-runs that often result in audible glitches in the VAC audio streams, both transmit and receive. The resampler acts to transform audio data across the radio clock domain and the PC clock domain, thereby substantially eliminating these glitches. The resampler also works for those who are using the VAC IQ data output at all IQ sample rates, and spur levels will be extremely low even at 192KHz."


The post speaks of "Resampler" checkbox in Setup > Audio > VAC1" but I see no such checkbox in Thetis.


There are many differences in the UI between PowerSDR and Thetis. In Thetis the resampler is enabled by default, hence there is no longer a checkbox. However you can force disable it by selecting the "Force" checkboxes in the diagnostic display.

2) It also speaks of a "diagnostic display" but I can't find that either.


This is the same in both PowerSDR and Thetis and is comprised of the area marked "VAC1 Monitor" in both programs.

3) It speaks of setting the "primary buffer size" and "VAC buffer size" but I can't find either of those defined or designated anywhere.


I'm sorry that there is no specific documentation for every feature of both programs. That is unlikely to change unless someone volunteers to write it. At any rate (ha, a pun!) the audio portion of the code in Thetis is quite a bit different than in PowerSDR and there no longer is a Primary Buffer to be set. There is, however, in both programs, a Buffer Size setting in Setup > Audio > VAC1. You can't miss it (or maybe you can?)

4) It also says that "the smallest possible ringbuffer on the receive side is 512, the smallest on the transmit side is 1024", but both default ringbuffer sizes on my screen (mine are labeled "In' and "Out" ringbuffers, not "Receive" and "Transmit") are 120, much smaller than either of the numbers noted in the post.


Yes, ignore all that, it is PowerSDR specific. In Thetis, as already mentioned, the audio portion of the code has changed substantially. There are a number of new controls for Buffer Latency, none of which having any direct relationship with the resampler. However, anecdotally the resampler does seem to work better with smaller numbers in all of these boxes, and the VAC buffer size as well. You will have to experiment. I like to set the buffer to the minimum, port audio to 0 (manual), and then start messing with the ringbuffer (again on manual). You need a way to monitor receive audio coming via VAC1 to know what works and what doesn't, it can be very hard to determine this merely by looking at the waterfall in WSJT-X or Fldigi (for example). I like to use Voicemeeter because I can route the audio to my PC speakers and listen to it for glitches and whatnot when doing these adjustments.
K1LSB
Posts: 639
Joined: Wed Feb 05, 2020 5:25 pm

Re: Resampler Adjustment

Postby K1LSB » Wed Jun 10, 2020 1:33 am

Thank you for clarifying Scott, that does help a lot.

Return to “PowerSDR mRX”