2
$\begingroup$

In the 1970s I made a CW “filter” based on a phase locked loop that detected a specific audio frequency, and this drove an NE555 oscillator: the result seemed at first like a “zero bandwidth” CW filter because as you tuned across the band, you only heard CW with one pitch. This was no doubt also invented by others, so not claiming anything here! But it always struck me that there was no ringing like we always got when using narrow CW filters of the type available back then.

Some people said that ringing was some kind of result from information theory, but I didn’t understand the argument. Maybe they were referring to what you get if you put pure noise through an infinitely steep bandpass filter...

What is the state of the art in narrow CW filters nowadays, and do they always ring?

Someone suggested the best might be found in the SDR field, but my knowledge of SDR is very basic. I can’t understand the technical SDR posts... yet.

One idea I had way back was having a very slight time delay so the filter could “look into the future” slightly, thereby increasing information content.

Also I wonder if a neural network could be trained on noisy CW so as to outperform humans on weak signal work? That sounds like a second question, but I am imagining AI-enhanced SDR, or maybe an AI-enhanced DSP (so same question actually).

$\endgroup$
5
$\begingroup$

I like your PLL approach, because it doesn't try to "recover the original signal from noise", but actually goes ahead and detects what you're actually interested in, the presence of a specific frequency, and uses that to generate a "perfect" tone. Much cleverer than spending hundreds on the best thinkable crystal filter on the market! (I'm always baffled when I go to ham trade shows and people boast how much they spent on the filters for their analog receivers. Congratulations, these people have found an expensive way to do something that is not what they want.)

When we say "filter", we usually mean the linear time-invariant system that convolves the filter impulse response with the signal (either in analog or digital). And for these, the math is non-negotiable: A narrow bandwidth (for a low-pass filter) literally means "nothing can change fast". A "end of CW pulse" is a fast change, end hence gets dragged into length. (We can do the same math for a band-pass filter, it doesn't change). That's the Fourier transform for you: can't be sharply defined in both domains, time and frequency (just as you can't know the position in impulse space and location exactly; Heisenberg says hello and wants his math back).

If convolution is a new term for you, look it up, there's a lot of nice animations out there; it's very intuitive. You're a theoretical physicist, so I assume you'll understand when I say that convolution is just the inner product of an $\mathcal L^2$ space of functions. For linear, time-invariant systems like classical filters, you get a very nice set of eigenfunctions: $\left\{e^{i\omega t}\right\},\,\omega\in\mathbb R$, and that tells you how it is that we can select frequencies with a filter: for any given LTI system, the response of the system to a given $\omega$ is just the eigenvalue.

So, with linear filters, ringing and narrow bandwidth are one and the same phenomenon.

Now, nothing says that a filter that we optimize for a narrow bandwidth is the best solution here - on the contrary: although it's called "CW", it's not a continuous wave at all (such a bad usage of words!): it's a sequence of modulated pulses.

If you know the length of the potential pulses, you could build a filter that is matched to the transmitted pulse shape. Again, pulling the theoretical physicist card on you: that's the filter that maximizes the convolution; i.e. the one that maxes the inner product. And if Cauchy-Schwarz inequality has told us anything, than that for complex-valued functions, that means that your receive filter needs to have an impulse response that is the conjugate time-inverse of the transmit signal's pulse shape.

That would essentially mean that the filter impulse response that the receiver convolves the received signal with a mirror of the expected transmit signal for a "dit" (or a "dah", when you think of that as a different pulse shape).

That's rather trivial to do if your signal is already digital – i.e. instead of continuous complex functions over $\mathbb R$, you only consider a sequence of complex values in a computer. Then, the convolution integral collapses to a sum, and with the length of these pulses, it's even a finite sum.

Implementing it like that means that you get a system where you get a clear peak at the output when there's a "dit" on the air. It's not as long as a "dit" anymore, mind you, just a high value when there's a "dit". Well, seeing that high value, you could of course then synthesize a "dit". Same for "dah".

Now, small problem here: there's humans shaping the pulse, and that's a terrible idea (for many reasons, but let's stay focused on this one): that makes the shape of the "dit" and the "dah" not exactly known.

You could solve that by giving your "dit" (and "dah") detectors more "leeway" to signal detection of a pulse even when the peak isn't that clear, or you could have a full bank of filters for different pulse shapes, and see which ones trigger. All these things are done in practice.

I'm not quite sure, though, how to answer the question of

What's state of the art in CW filters

because state of the art would

  1. not do CW, that wastes the precious bandwidth-power product that makes your signal differ from measurement noise, and
  2. when trying to detect CW, one wouldn't do a pure filtering – but, really, use a PLL like you did, to first recover the frequency, and then use something that tries to make sense of the different pulses visible there.
    There's a lot of approaches there – from "modern style" machine learning with neural networks to empirical models.
| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Marcus thanks, that is super-interesting! Yes, I do understand convolutions. I think my 1979 teenage ham radio brain never thought of speaking to my physics brain :-) Your comments make me imagine a version of "CW" mode in which the speed is perfectly constrained/defined as well as the shape of dits and dahs, and in which spaces are an integer multiple of the length of a dit. Such a CW mode would allow humans to enjoy the fun of copying CW and would allow a computer-assist in pulling the signal out of the noise. It is sort of true that "state of the art" and "CW" are at odds with each other. $\endgroup$ – RiskyScientist May 31 at 14:42
  • $\begingroup$ yep, and that's why hotpaw2's answer is so valuable: the optimal detector problem is a very nonlinear one - and nonlinear inverse problems are... problematic, ha. That's the beauty of neural networks: the Universal Approximation Theorem says that you can build any continuous function $y=f(\vec x): \, \mathbb R^N \mapsto \mathbb R$ by something that's structured like a classical artificial neural network¹. And that representation has a computable gradient – and that makes looking for optima possible! So, you model the problem "CW discriminator" as a neural network with a load of unconstrained $\endgroup$ – Marcus Müller May 31 at 15:29
  • $\begingroup$ parameters, and then tweak the parameters a bit, see how that improves the quality of the network as CW discriminator, by calculating the gradient at the new parametrization, and using that for a gradient descent optimization. That way, high-dimensional non-linear systems can heuristically be brought close to an optimum. Funky math, but if you don't only look at Neural networks as what recognizes cats and human faces in pictures, but as to find an optimal mapping of a high-dimensional input to a lower dimensional output, it's not as "magical". $\endgroup$ – Marcus Müller May 31 at 15:32
  • $\begingroup$ ¹Neural network: imagine a neuron $z_k(\vec x)$: That's a weighted sum of its $J$ inputs, plus a bias, passed through basically any nonlinear function (activation function, often something like $a(x) = \tanh(x)$ or just $a(x) = 0 \text{ for }x < 0, x \text{ else}$): $$z_k(\vec x_k) = a\left(\sum_{j = 1}^{J}w_{k,j} x_{k,j} +b_k\right)$$ Now, you put many of these $z_k$ in parallel, and call that a layer. You can have the output of one layer be the input for the next. A final layer can be the aggregation layer needed to give you the desired output dimensionality. The parameter vector $\endgroup$ – Marcus Müller May 31 at 15:52
  • $\begingroup$ $\Theta = (w_{1,1},\ldots,w_{K,J}, b_1, \ldots, b_K)$ is what you can tweak until your network is the mapping you were looking for. As mentioned before, that tweaking is made through looking at the gradient of some "goodness" function of the output, which you can now calculate, because the mapping is really just a sum and concatenation of functions whose gradients are easy to calculate. Makes walking in the direction of a local optima easy! Add a bit of adding noise to these parameters to avoid getting stuck in local optima, and you're understanding more about Neural Networks than 99% of $\endgroup$ – Marcus Müller May 31 at 15:52
4
$\begingroup$

Ringing in narrow filters may already have an answer here: https://dsp.stackexchange.com/questions/2170/why-do-i-see-ringing-in-the-output-of-a-digital-filter-with-a-narrow-transition

"looking into the future", or more realistically, a filter delay, seems to be a requirement to reliably estimate the shape and time location of the falling (and rising) edges of a CW envelope, if one is doing envelope (dot or dash duration and shape) detection, say by using some matched filters. You can get rid of ringing by using leading and trailing edge detection to gate a resynthesis audio oscillator on and off (or use your preferred audio tone envelope).

AG1LE has blogged about training a LSTM neural net to decode whole Morse Code characters (rather than just dots and dashes) from an FFT/STFT waterfall. See: http://ag1le.blogspot.com/2017/11/tensorflow-revisited-new-lstm-dynamic.html

My experiments tend to confirm that data augmentation by adding various noise sources commonly found in RF to Morse Code training data improves ML/DNN inference.

After decoding, one could feed the ML inference output to a tone resynthesizer.

IIRC, CW Skimmer reportedly uses statistical signal detection methods, e.g. updating the Bayesian probability that a tone pulse of a particular length has occurred based on previous and subsequent tone pulse and common Morse character sequence likelihoods. I suppose you could resynthesize things that have a 99% chance of being a dot or dash, and squelch (or reduce volume on) the rest.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Hotpaw2 thanks for the references and your experience with DNN Morse code detection. The reference to CW Skimmer led me to look at the website - I must admit the decoded contest pileup is totally amazing to me. What would make your answer even more interesting is some information about whether such ML techniques are in common use in contests or by DXers - and maybe what kind of performance improvement is possible using such techniques (in broad terms). You can imagine copying low power DX CW signals in a way not possible before. You would need some power for them to hear you though... $\endgroup$ – RiskyScientist May 31 at 15:03
  • $\begingroup$ Both of you guys have more than answered my question - you guys have motivated me to dig in and learn about SDR and digital modes. I had previously learned about DNNs from Michael Nielsen’s online book - the basics are so simple I was able to code up DNN in Excel using the Solver function to train it. It learned to price stock options including volatility skew. Looks like there is yet another cool aspect of ham radio to explore - thanks to you both! $\endgroup$ – RiskyScientist Jun 2 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.