[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linrad] RE: CW decode in Linrad

Hi Niels,

> I have been browsing through the cwdetect.c and cwspeed.c 
> source code and wondered if you had any development notes 
> or simple program flow description. 
> I understand that this part of Linrad is still far from 
> complete but I am very interested in finding out how this 
> portion of the software will function.

The CW decode routines are in terra incognita. Everything I
have written is included in the code. The way it works is 
basically as follows:

1) Based on the assumption that the user has selected a close
to optimum filter bandwidth Linrad looks for the occurance of
dashes. Whenever the signal is above the average power level for
about 3 times the expected duration of a dash Linrad assumes a 
dash really was present in this first search. A coherent average
is formed over all such events.

2) When many enough waveforms are accumulated, Linrad evaluates 
the shape of the average and assumes that the complex waveform 
really represents a morse code dash (with chirp and other defects
in case they occur).

3) Having a waveform, Linrad looks for every occurance of similar 
waveforms and decides they are probable dashes. The average waveform
of all such probable dashes is collected and this average gives
a new and better waveform for dashes. It also gives a value for
the cw keying speed since the average waveform contains minima on
both sides of the dash waveform that can be determined with a good 

4) Having several dashes it is possible to estimate the signal level
a morse code part would have if it were present close to or between
the dashes already located. This knowledge can be used to decide 
whether a known dash is surrounded by dots, dashes or key up.

5) Linrad looks whether there are any complete morse code
characters. If there are, the ascii characters are filled in.
This is the current point of development. The idea is to continue 
by evaluating the keying speed accurately, then building ascii 
characters at points where only a small number of different 
characters is possible.

6) In case 5 has failed and more than X (currently 30) Morse code 
elements have been located, Linrad looks for repetitive patterns.
If repetitive patterns are found, Linrad forms an average of the
complex waveform (coherent averaging) and uses the average to 
decide where the key is up or down based on the positive in-phase
amplitude. The signal during these times is used to form a new
carrier which is hopefully less noisy than the original carrier
from which the coherent baseband signal was computed. The new 
carrier is used to compute an improved baseband signal which
is coherently averaged over the regions that contain similarities.
This is the current point of development with Linrad-01.27.

                             --  0  --

For coherent averaging I use the file unkn422.wav from AF9Y.
Linrad finds 3 occurences of "AF9Y" but the only 100% detect is 
the "Y". From the correct code:
. _    . . _ .   _ _ _ _ .   _ . _ _  
the following elements are currently decoded:
  _    . . _       _ _ _ .   _ . _ _

I will try to use this information to improve the carrier and to
improve the average waveform by weighting by S/N when forming the 
average. EME signals suffer from rather rapid QSB. That is the 
difficulty that I try to overcome with the rather complicated 
processing of Linrad. The signal level goes through zero for
all three occurancies of the undecoded sequence between F and 9
so decoding will not succeed although it is possible that the
9 will be firmly established.

The AF9Y sequence is 59 morse code bits in length but the 
occurancies are separated by 315 code bits. It does not seem 
likely that the unknown call sign is 256 code bits in length 
so there could be two more occurancies of AF9Y which would 
mean that the unknown call has a length of 98 bits. It is 
also possible that the sequence is AF9Y followed by repetitive 
occurancies of the unknown call sign.

I am sure Linrad will not ever decode unkn422 but it is a good
test case because it contains all the difficulties. Non-linear
frequency drift, QSB and carrier broadening due to the multipath
propagation via EME and inaccurate keying. The repetitions do
not match exactly.

For the continuation of 5) I am using other signals that suffer
from other defects. The two paths will be merged so repeated 
occurencies of groups of characters will be used also in the 
straight detection in case it is required.

CW decoding is something I work with on my lap-top computer
when I have idle time. It will take a long time until it is
operative for normal qso-ing.


Leif / SM5BSZ