softsyst / qirx_issues

Issue tracker for QIRX
1 stars 1 forks source link

Suggestion: Showing the frequency of the pilot tone in the MPX spectrum #163

Open Drehrumbum opened 1 month ago

Drehrumbum commented 1 month ago

Hi Clem!

Recently, in a completely different context, I remembered an old thread that I have now found again in the German-language 'rundfunkforum'. This thread from 2007 is about the highly precise determination of the frequency of the pilot tone in the MPX signal of commercial FM transmitters in order to determine whether several transmitters are broadcasting the same MPX signal (e.g. ball reception) or whether the audio signal is being sent from the broadcast studio to the individual transmitters and the MPX signal is generated there.

https://www.rundfunkforum.de/viewtopic.php?f=4&t=18648

I think, this is still interesting stuff, because today we have the 'Bundesmux' on DAB+ as a nationwide GPS-controlled frequency standard, highly stable TCXO quartz crystals in the SDR dongles and the possibility of calibrating a wide variety of dongles quite precisely using the DAB signal and QIRX.

What do you think about it? How accurately can we measure? (<1mHz would be nice) Would the measurements (two dongles previously calibrated via DAB on two different computers measuring the same station) be comparable?

BFN Heiko

pilot_of _the_airwaves

softsyst commented 1 month ago

Hi Heiko,

Not sure whether I understand your motivation correctly. I have no idea yet what would be the effort to measure the pilot tone of 19kHz with an accuracy of 1mHz. The problem sounds interesting though. I'll think about it. In any case the requirement in the resolution would be orders of magnitude higher than what the audio spectrum currently delivers. However, the necessity would be to measure only the pilot and not the rest of the spectrum as well.

Clem

softsyst commented 1 month ago

Heiko,

Some experiments were made. The method is straightforward: Take the isolated 19kHz carrier, downsample it to the lowest possible frequency (Nyquist), collect a sufficiently long buffer, dump it into a suitable FFT, and read the frequency. In that way, it seems well possible to get an accuracy of <10mHz. I'll come in a moment to the 1mHz issue.

The steps:

Before starting: the used device frequencies were DAB-calibrated.

  1. A narrow IIR Filter of the 19kHz carrier, as is already present for the stereo processing. To determine an accurate bandwidth of that filter has not been done.
  2. Downsample this (real-valued) signal to 64ksps, from 256ksps. A no-brainer. The least possible sampling rate would be 38kHz, and the next power of two is 64ksps, for easy processing.
  3. No comes the step to get the FFT with a suitable resolution. I selected a buffer length of about 4Msamples, leading to an accuracy of 64ksps/4M -> 15mHz.
  4. Problem: The time for collecting the buffer. With the indicated numbers, it takes about 1 minute for a measurement. If we increase the accuracy by a factor of 10, we needed 10 minutes for a measurement, which is unrealistic.
  5. The last step is the readout of the value. You see on the pictures that I - for this rapid prototype - omitted the horizontal scale, but the yellow triangle on top is an indication for 19000.00Hz, and the frequency of the peak is indicated by the tooltip of the cursor. If this method should make it into the product, of course the horizontal scale must be provided.

The pictures assume an exact sampling rate of 64kHz, thus the relative difference between stations might be deduced from the pictures. The value of the exact sampling rate accuracy is a separate problem, affecting the absolute frequency accuracy. I will try to get a value from sdrplay, as the RSPdx can be fed with an external reference frequency, which I could provide rather accurately (Rubidium Standard). I am not sure whether the sampling rate accuracy is the same as the DAB-calibrated frequency accuracy.

Here some pictures, estimated accuracy 15mHz, as expected:

Unzoomed hr2 overview: 19kHz_hr2

DLF 19kHz_DLF_30mHz

hr2 19kHz_hr2_0mHz

BR-KLASSIK (weak, upper end of the spectrum, near 108MHz): 19kHz_BRKLASS_RSP_m200mHz

BR2 (weak, lower end of the spectrum, near 89MHz) 19kHz_BR2_RSP_m200mHz

FFH 19kHz_FFH_RSP_50mHz

So much for now.

Clem

Drehrumbum commented 1 month ago

Hello Clem!

Sorry for the delayed answer and many thanks for your first experiments! Looks good so far.

Well, I'm not a DSP guru, but related to the problem: We can shorten up the time for collecting time-domain data in front of an FFT by zero-padding the input-buffer till its end after we filled it up with data just for some seconds. Our pilot-tone is stable (it doesn't wobbling around within some seconds) and stands relative free, so we'll find its sharp peak-frequency in the spectrum, if we we zero-pad the buffer. It's the same like in this article:

https://dsp.stackexchange.com/questions/11560/why-do-we-say-that-zero-padding-doesnt-really-increase-frequency-resolution?rq=1

Heiko

softsyst commented 1 month ago

No problem with the delay! Thanks for the link. I'll have a look and try. Seems too easy! Sadly, the link for the app in the referenced rundfunkforum thread seems to be dead.

Clem

Drehrumbum commented 1 month ago

The program is still there (https://www.qsl.net/dl4yhf/spectra1.html) and real cool stuff:

The last time I used this program was a good 15 years ago when I saw a strong line at about 32.7 kHz in the spectrum of 96 kHz voice recordings done with condenser-mics at home. It was (of course) the quartz in my watch that was "roaring" into the recordings purely acoustically. This was easily detectable with this program after I moved this frequency into the audible range in real-time and heard the Doppler effect when moving my arm... ;)

Drehrumbum commented 1 month ago

Just to say it. If you need a "tester" for all this stuff, my dongle is "really good" when it is warm.

my_dongle

And then we could use the high power transmitters from Brocken, which should also reach Frankfurt. Here in the example the 100 kW ND from "radio SAW" with the much too short DAB antenna. AFAIK, "radio SAW" from Brocken reaches Hamburg ("Elbtunnel")...

radio_saw

BFN Heiko

softsyst commented 1 month ago

Thanks for the updated link. Next step will be to make a test with the padding method. Currently I have not too much time, due to personal obligations. If I have something, of course you can get a version for testing. On 101.4 I get a station. It's Radio Bob, 200W from "Ginnheimer Spargel" aka Ffm Europaturm.

Clem

softsyst commented 1 month ago

Heiko,

Sorry for the delay. Foolish as I was, I wrote the comment and (obviously) forgot to push the button. This was already last week. Anyway, here come the tests with the padding. The method seems to work.

The first pic shows the fft of a 4M buffer, filled from the start with 524288 samples, 8 seconds duration, the rest padded with zeros. The yellow triangle again shows the 19000Hz position. The peak is at about 250mHz lower than the 19k position: image

The 2nd pic shows the 4M buffer fft of the same signal, filled from start with 262144 samples, 4 seconds duration, rest zeros. image

The padding is an interpolation. The math foundation is described here.

Possibly, this can be further optimized.

Clem

Drehrumbum commented 1 month ago

Hi Clem!

Well done. ;) It seems, the interpolation (and the side-lobes next to the peak) because of zero-padding the buffer doesn't bother us. It’s just the price we have to pay for a real short sampling-time. (Okay, we only can do that in this special case because there is only some noise next to the much stronger and stable pilot tone.) But the most important thing is that the peak of the pilot tone is exactly where it is when you fill the buffer completely with samples.

This brings me to the next step, which I think you've already tried:

We can

TIA & BFN Heiko

softsyst commented 1 week ago

Heiko,

after some time, I have a running solution based on your suggestion and my tests, with the 8sec filling buffer. Doesn't look spectacular, but should work:

image

Pushing the "Calc. Stereo Pilot Freq." button starts the calculation in the background,independent from what is displayed on the GUI. The result is displayed every 8 seconds, with an indication of 1mHz, obtained from a padded 4M real-valued FFT spectrum of the narrowly filtered 19kHz carrier, as described in the last posting. However:

Due to the effort, I did not put work into more flexibility with respect to the parameters. If this proves to be useful, we could think about it.

I intend to include this into the next version, soon to come.

Clem