Tuesday, December 31, 2013

New Morse Decoder - Part 3

New Bayesian Morse Decoder 

In my previous blog entry I shared the first test results using Bayesian CW decoder integrated to FLDIGI.  As I indicated the software has still bugs but when it works the accuracy improvement compared to the legacy FLDIGI decoder was pretty impressive.  I was testing again tonight as ham bands were full of CW stations working in ARRL Straight Key Night.  I made also many audio file captures to be used as  additional testing material.

However,  as my alpha testers have also noticed the current decoder is very sensitive to proper audio signal settings.  In order to analyze this problem a bit more details I re-implemented FLDIGI audio processing chain from audio file playback to the decoder (including the FFT filtering in CW.CXX) in a standalone version of the Bayesian Morse Decoder.  It was easier to run a series of tests by just varying command line variables and WAV audio files  and capture the results for analysis & plotting the data.

After running a series of tests I compared the signal amplitude against decoder errors and found a very sharp non-linear behavior related to speed estimation algorithm.  By increasing signal volume by only 0.06% I was able to re-produce this event that alpha testers found and also capture the dynamic behavior of various parameters, including <spdhat>  that I used below to plot the speed estimate over time.

Figure 1. below shows that initially the speed tracking is trying to find the correct speed (in this case 40 WPM) but fairly soon it goes down below the lower limit 10 WPM  and is not able to recover from this error situation. This is similar behavior that alpha testers have seen.
Figure 1.  Speed estimator bug

I  scaled down the signal strength by only 0.06% and now the speed estimator works much better.   In Figure 2. below  the speed tracking fluctuates between 13 and 48 WPM until it settles to about 38 WPM.   Despite this tracking behavior the decoder produces  correct results from a noisy test file.

Figure 2.  Normal speed estimator behavior




I am very thankful for those brave hams who took this first  (broken) alpha release and provided me not only good  feedback but also some WAV file examples  that I have been able to use to track down these problems.

I have also converted all the files from C  to C++  to make it easier to re-integrate to FLDIGI.  I will continue cleaning up the code and keep working to improve the speed estimator.  Once I have the next alpha release ready for another set of tests I will announce it in the fldigi mailing lists and eham.net CW forum.

73 and Happy New Year

Mauri  AG1LE



16 comments:

  1. HNY 2014 to you and your family !

    Great Stuff ! Many thanks for your work.

    regards
    Mario, DH5YM

    ReplyDelete
    Replies
    1. Happy New Year Mario!

      Thanks for the WAV files - very useful test material.

      regards
      Mauri, AG1LE

      Delete
  2. Hi Mauri,

    i noticed that i missed to switch off the AGC of the receiver software. Therefore you may get jumps in the scaling of the signals if a strong signal appears somewhere in the passband. Hopefully thats not an issue.


    regards
    Mario

    ReplyDelete
  3. Hi Mauri,

    for some reason i cannot build fldigi on my new xubuntu x64 system.
    There seems to be an issue with FLTK. I have version 1.1.10 according to the return of fltk-config and the error output of the make is:
    ‘Fl_Fontsize’ does not name a type
    This occures in several types. Do you have an idea what wents wrong ?

    regards
    Mario

    ReplyDelete
    Replies
    1. Hi Mario
      I googled the error and found references to fltk v1.3.0 version. Looks like Dave W1HKJ did some changes about 1.5 years ago to enable compatibility to this later version. Can you update your fltk version and try building again?

      Delete
  4. Latest version in Ubuntu 13.10 is 1.3.1.
    Here i get a different kind of error:

    fileselector/fileselect.cxx:109:16: error: ‘namespace FSEL { }’ redeclared as different kind of symbol
    namespace FSEL {
    ^
    In file included from fileselector/fileselect.cxx:30:0:
    ./include/fileselect.h:9:7: error: previous declaration of ‘class FSEL’
    class FSEL
    ^fileselector/fileselect.cxx:109:16: error: ‘namespace FSEL { }’ redeclared as different kind of symbol
    namespace FSEL {
    ^
    In file included from fileselector/fileselect.cxx:30:0:
    ./include/fileselect.h:9:7: error: previous declaration of ‘class FSEL’
    class FSEL
    ^fileselector/fileselect.cxx:109:16: error: ‘namespace FSEL { }’ redeclared as different kind of symbol
    namespace FSEL {
    ^
    In file included from fileselector/fileselect.cxx:30:0:
    ./include/fileselect.h:9:7: error: previous declaration of ‘class FSEL’
    class FSEL
    ^

    Seems something changed again in FLTK. Unfortunately my programming skills are not enough to understand whats going on. At least not on short notice ;)

    On my 32bit machine i have FLTK 1.3.0 installed and there there is no problem compiling fldigi. Unfortunately the 32bit PC is a bit slow ;)

    regards
    Mario

    ReplyDelete
  5. Hi Mauri,

    after some updates and changing to libportaudio2 it suddenly compiled.
    Now i can try a bit. I already saw that the speed estimation sometimes jumps to a very high negative number and cannot be resumed. It is necessary to restart FLDigi.

    regards
    Mario

    ReplyDelete
  6. Hi Mario

    This is a bug in the speed estimation algorithm. Please go to proces.c and change the initialization of dur[] array on line 83:

    real dur[25] = { 1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,
    1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,1e3f,
    1e3f,1e3f };

    to the following values: 9e3f;

    You need to rebuild FLDIGI from the source after this change.

    In my experiments this has stabilized the speed estimation a bit more. There is still something else going on that need more debugging. Let me know if you find anything else.
    73
    Mauri

    ReplyDelete
  7. I posted a beta release of new Bayesian Morse Decoder on Dave's web site
    http://www.w1hkj.com/ag1le/

    File name is fldigi-3.21.77.bayes.tar.gz

    ReplyDelete
  8. Hi Mauri,

    i'm trying to find a working cw decoder to use with beacon monitoring experiments. I'd like it to be run on Raspberry Pi - and, it needs to be able to run without graphical UI.

    Do happen to have any suggestion for me?

    73,
    Jukka OH2BUA

    ReplyDelete
  9. Hi Jukka

    I have one version of the Bayesian Morse decoder that runs from command line.
    Check out latest version from https://github.com/ag1le/morse-wip

    This version reads WAV audio files [see static void
    process_sndfile (char * filename)] or text files [see static void process_textfile(char *filename)] and prints decoded characters to stdout if option -txt is selected on command line.

    You could modify the code in bmorse.cxx dealing with incoming signals to suit your purposes for beacon monitoring.

    I have left this code (same code but different version integrated to FLDIGI) running for 2 weeks monitoring NCDXF/IARU beacons on 14,100 MHz and it was working quite well. The only challenge with current version is that first letter of transmissions gets misdecoded fairly often because speed estimation routine does not adapt quickly enough. Since beacons are always sending at 22 WPM this might be fixed by adjusting some parameters.

    Let me know if you need any help with this.

    73
    Mauri AG1LE

    ReplyDelete
  10. Tks for your reply!

    It is NCDXF stuff i'm thinking of. I have already made a script to command my rig to change band according the transmission schedule. And to grep the decoded text file to find at least four letters to be copied right, to assume that the beacon is heard.

    I will try to compile and run your decoder this week.

    BTW, can i expect the decoder to process the WAV files in real time... or possibly faster... or slower (in RasPi)?

    73,
    Jukka

    jukka
    ät
    247solid
    piste
    com

    ReplyDelete
    Replies
    1. Hi Jukka
      I have not tested this on Rasberry Pi yet. On Thinkpad X301 laptop with Linux Mint 14 the software runs faster than real time processing WAV files. There is a way to reduce computational load so if you run into trouble on RasPi let me know.

      Delete
  11. Hmm.. having some problems in compiling... the ./configure script is missing...

    pi@raspberrypi ~/morse-wip $ ./configure
    -bash: ./configure: No such file or directory
    pi@raspberrypi ~/morse-wip $ autoconf
    autoconf: error: no input file
    pi@raspberrypi ~/morse-wip $ automake
    automake: `configure.ac' or `configure.in' is required

    Jukka

    ReplyDelete
  12. we can apply the method detailed on http://www.iis.sinica.edu.tw/page/jise/2007/200709_20.pdf?
    we can work together if you like

    ReplyDelete
  13. Hi léo abdel

    I have read this paper earlier. Do you have any of this software available? I would be interested understanding how you use fuzzy SVMs. I tested a few neural network methods earlier to classify key states but was not very happy with the overall performance.

    ReplyDelete

Popular Posts