# How to filter key clicks?

I am the author of an amateur radio application that produces a waterfall display across a range of frequencies. Time is on the $x$-axis, frequency is on the $y$-axis, and the relative strength of each signal is depicted by the intensity of color.

Some of the signals have, what are called, "key clicks". That is, at the start and end of each signal, the bandwidth of the signal is wider than the steady-state bandwidth. An example is shown below:

[1] http://www.kkn.net/~n2ic/key_clicks.jpg

These are actually present in the signal - They are not artifacts of my DSP processing. I would appreciate suggestions on how to filter out the key clicks.

• May I ask, if the clicks are present in the signal, why do you want to filter them out? You would be presenting inaccurate information to the user. – MBaz Dec 29 '16 at 23:36
• In addition to what @MBaz correctly questions, if you are not happy with the transient representation of your spectrogram, try to change the spectrogram parameters. Window function type and window duration are the two main parameters that will affect the reproduction of transients. – Jazzmaniac Dec 30 '16 at 13:08
• The key clicks are nothing but an annoyance to the user. – Steve London Dec 30 '16 at 23:20
• I am using a Blackman Harris 7 filter, followed by polyphase filtering to reduce leakage into adjacent bins. Suggestions on what to try to reduce the display of the key clicks ? Thanks. – Steve London Dec 30 '16 at 23:24
• Can you show an excerpt of the time domain waveform that contains the start (or end) of one of the tones? As others have pointed out already, what you are seeing is most probably an artifact of the spectral visualization that you are using and not part of the actual signal. In general, it is not possible to completely avoid this phenomenon which in your case seems to be caused by sinosoids being switched on (or off, respectively) within the spectral analysis window. You could, as @Jazzmaniac pointed out, experiment with the window parameters to find a satisfactory compromise. – applesoup May 3 '17 at 0:17

Assuming from your screenshot that the frequency magnitudes of "key clicks" are always higher (brighter) than the normal signal, you could just employ a basic Limiter? In other words, if a frequency magnitude value exceeds a certain threshold, set that frequency value to its last (valid) value. If you wanted to keep the plot from looking unnatural, you could simulate the data where the clicks are or use data from previous samples.

• The magnitude of the key clicks are much lower than the main signal. – Steve London Dec 29 '16 at 23:12
• So do the same thing but gate signals lower than a threshold? – user2348114 Dec 30 '16 at 0:57
• the suggestion is to limit the frequency bins, not the time domain signal – Stanley Pawlukiewicz Jan 26 '18 at 3:53

I guess that the visual click in your spectrum is due to the signal being turned on (or off) inside the FFT window. Your window function works fine with a signal which is present throughout the FFT window, but when the signal is turned on close to the middle of the window, it's like applying a rectangular window.

The easiest way to check my "hypothesis" is to look at the time signal.

You can put a 0.01 $\mu$F capacitor across the terminals of your telegraph key.

That might do the trick.