# Decoding morse

• Subject: Decoding morse
• From: Leif Asbrink <sm5bsz.com; leif@xxxxxxxxxxxxxxxx>
• Date: Thu, 29 Nov 2007 00:23:50 +0100

```Hi All,

The problem of decoding CW in the computer for weak and
unstable signals (as those we have in EME) is an interesting
challenge that I have been looking at now and then over the
years. Now, on vacation at a nice place in the Carribean I
have plenty of time at the pool side so I am looking at it
again:-)

I have a reliable algorithm for establishing the keying rate
of signals well below what I can reliably decode by ear. It
is based on finding dashes, they last long and therefore
have more energy in a narrower bandwidth compared to dots.

The problem I face now is to fill in what is the most probable
pattern of what I have between two reasonably close spaced dashes.

1) length = 3
___ _ ___   case 1
___   ___   case 2
123
These two waveforms differ only in position 2.

2) length = 5
___ _   ___  case 1
___   _ ___  case 2
___ _   ___  case 3
___ ___ ___  case 4
___     ___  case 5
12345
These five waveforms differ in positions 2, 3 and 4.

I have the baseband as a complex pair I and Q and I compute
the sum (integral) over the correct time intervals of a
morse code unit (a dot.) I also compute the RMS power
over each time unit.

A typical result for a good EME signal (G4LOH in the FRH1135
recording) is like this for the first case:
The complex amplitude of the dashes surrounding the
region is (5.146,-5.941) and (7.164,1.704) before respectively
after. It means that the phase has drifted by about 45 degrees
over the time interval and I can assume that the phase of a dot
would be the average of the of the surroundings which means
that I would expect an amplitude of something like (6.155,-2.118)
When computing the amplitude as the average of I and Q over the
three time intervals I get:
reg 0 (1.043,-0.339)  pwr  2.90  1.20
reg 1 (7.109,-1.924)  pwr 59.94 54.24
reg 2 (0.551, 0.503)  pwr  4.05  0.55

This is obviously a dot. The complex amplitude for the center
position fits closely to what one would expect. The numbers
after pwr is the RMS power followed by the sum of squares of
the I and Q amplitudes.

Under the assumption it is really a dot, I can compute the noise
power level as (1.2+0.55+0.947)/3=0.899 while the signal power
would be 54.24 for a S/N of 60.33

Under the assumption there is no dot, the noise power would be
18.66 on the average and 62 times higher in the center region
compared to the average of the two surrounding regions that have
to be key-up.

I am writing this to MOON-NET and the Linrad list  because I hope
someone could help in translating what I can compute into the
probability of having a dot in situations where it is not so
obvious. I assume it is reasonably easy for someone who has the
appropriate knowledge of statistics (that I do not have.)

I would also be interested to know how one computes a probability
for a dot based on the RMS powers for the three regions:
1.2, 54.24 and 0.55. I guess the ratio 54.24/( 0.5*(1.2+0.55))
translates directly to a probability (much greater than one)
for a dot and another (close to zero) for a space.

-----------------------------------------------------------------
In the second case, with five possible waveforms a typical
case from the same recording is:

Surrounding dashes: (8.202,-0.480),(7.078,-6.384)
Evaluation for a dot on each of the 5 positions:
reg 0 ( 0.169,-0.420)   pwr  2.406  0.205
reg 1 ( 7.134, 1.780)   pwr 60.375 54.075
reg 2 ( 0.429,-0.005)   pwr  5.370  0.184
reg 3 ( 0.025,-0.094)   pwr  2.603  0.009
reg 4 (-0.664, 0.193)   pwr  1.888  0.478
Evaluation for a dash:
reg 123 (2.667,-0.473)  pwr 23.443  7.339

This is obviously case 3, but how do I convert the result
from amplitudes/powers to five probabilities (that sum up
to 1.00) ??? Anyone knows?

I expect two sets of probabilities. One based on the
integrated power over 1 respectively 3 morse code time
units and another based on RMS powers. (Sometimes an EME
signal changes its phase rapidly during a QSB minimum
and then RMS powers could be more adequate than averaged
I and Q signals.)

I have a feeling it should be an easy problem - but not
so to me:-(

A realistic case, from the famous unkn422.wav file by AF9Y
is like this:
Surrounding dashes (-3.078,0.987),(-2.545,-1.678)
reg 0 ( 0.476,-0.060)  pwr  6.127 0.230
reg 1 (-2.457,-0.325)  pwr 17.513 6.146
reg 2 (-2.192,-0.368)  pwr 15.392 4.941
I know this is a dot because it is a part of the Y in AF9Y,
but I do not know what criterion to apply for the software
to take a decicion that a dot is much more probable than
a space or vice versa. Leaving the choice to a later state
when some more parts are decoded is not very attractive
since too many uncertainties will make it difficult to
take decisions for longer regions.

Any help would be much appreciated.

73

Leif / SM5BSZ

--~--~---------~--~----~------------~-------~--~----~