in reply to Morse code via sound card input

I just did some playing with the PDL::FFT method (which I mentioned above by toma). It's only drawback, is it needs wav files to analyze.... no realtime reading from the dsp (unless maybe a chunk method of reading the dsp could be done?). I used a mechanical generator (Perl) to make a wav file 'A A A'. That is a di dah pause di dah pause di dah. The tone frequency was 400Hz. The resultant output follows below, it is a timestamp followed by frequency. As you can see, the 400 Hz shows up nicely, and the inter-di-dah slience is 105. The silence between letters can seen as 8.23. Now I can't say whether this is related to my particular soundcard, or what or non-standard conditions are in place, but it does show a method for doing the FFT on the audio..... the big glitch now is reading it off off the dsp directly. FWIW, I did see a hardwired unit that did this for $89 dollars on the internet. Maybe it's easier to do which real electronics?
0.01 400.00 0.01 400.00 0.02 400.00 0.02 400.00 0.02 400.00 0.02 400.00 0.03 400.00 0.03 400.00 0.03 400.00 0.03 400.00 0.04 400.00 0.04 400.00 0.04 400.00 0.04 400.00 0.05 400.00 0.05 400.00 0.05 400.00 0.05 400.00 0.06 105.26 0.07 105.26 0.08 105.26 0.08 105.26 0.09 105.26 0.10 105.26 0.11 105.26 0.12 105.26 0.13 105.26 0.14 105.26 0.15 400.00 0.15 400.00 0.16 400.00 0.16 400.00 0.16 400.00 0.16 400.00 0.17 400.00 0.17 400.00 0.17 400.00 0.17 400.00 0.18 400.00 0.18 400.00 0.18 400.00 0.18 400.00 0.19 400.00 0.19 400.00 0.19 400.00 0.19 400.00 0.20 400.00 0.20 400.00 0.20 400.00 0.20 400.00 0.21 400.00 0.21 400.00 0.21 400.00 0.21 400.00 0.22 400.00 0.22 400.00 0.22 400.00 0.22 400.00 0.23 400.00 0.23 400.00 0.23 400.00 0.23 400.00 0.24 400.00 0.24 400.00 0.24 400.00 0.24 400.00 0.25 400.00 0.25 400.00 0.25 400.00 0.25 400.00 0.26 400.00 0.26 400.00 0.26 400.00 0.26 400.00 0.27 400.00 0.27 400.00 0.27 400.00 0.27 400.00 0.28 400.00 0.28 400.00 0.28 400.00 0.28 400.00 0.29 400.00 0.29 400.00 0.29 400.00 0.29 400.00 0.30 400.00 0.30 400.00 0.30 400.00 0.30 400.00 0.31 400.00 0.31 400.00 0.31 400.00 0.31 400.00 0.32 400.00 0.32 400.00 0.32 400.00 0.32 400.00 0.33 400.00 0.33 400.00 0.33 400.00 0.33 400.00 0.34 8.23 0.46 8.23 0.58 8.23 0.70 8.23 0.82 8.23 0.94 8.23 1.07 8.23 1.19 8.23 1.31 8.23 1.43 8.23 1.55 400.00 1.55 400.00 1.56 400.00 1.56 400.00 1.56 400.00 1.56 400.00 1.57 400.00 1.57 400.00 1.57 400.00 1.57 400.00 1.58 400.00 1.58 400.00 1.58 400.00 1.58 400.00 1.59 400.00 1.59 400.00 1.59 400.00 1.59 400.00 1.60 105.26 1.61 105.26 1.61 105.26 1.62 105.26 1.63 105.26 1.64 105.26 1.65 105.26 1.66 105.26 1.67 105.26 1.68 105.26 1.69 400.00 1.69 400.00 1.70 400.00 1.70 400.00 1.70 400.00 1.70 400.00 1.71 400.00 1.71 400.00 1.71 400.00 1.71 400.00 1.72 400.00 1.72 400.00 1.72 400.00 1.72 400.00 1.73 400.00 1.73 400.00 1.73 400.00 1.73 400.00 1.74 400.00 1.74 400.00 1.74 400.00 1.74 400.00 1.75 400.00 1.75 400.00 1.75 400.00 1.75 400.00 1.76 400.00 1.76 400.00 1.76 400.00 1.76 400.00 1.77 400.00 1.77 400.00 1.77 400.00 1.77 400.00 1.78 400.00 1.78 400.00 1.78 400.00 1.78 400.00 1.79 400.00 1.79 400.00 1.79 400.00 1.79 400.00 1.80 400.00 1.80 400.00 1.80 400.00 1.80 400.00 1.81 400.00 1.81 400.00 1.81 400.00 1.81 400.00 1.82 400.00 1.82 400.00 1.82 400.00 1.82 400.00 1.83 400.00 1.83 400.00 1.83 400.00 1.83 400.00 1.84 400.00 1.84 400.00 1.84 400.00 1.84 400.00 1.85 400.00 1.85 400.00 1.85 400.00 1.85 400.00 1.86 400.00 1.86 400.00 1.86 400.00 1.86 400.00 1.87 400.00 1.87 400.00 1.87 400.00 1.87 400.00 1.88 8.23 2.00 8.23 2.12 8.23 2.24 8.23 2.36 8.23 2.48 8.23 2.60 8.23 2.73 8.23 2.85 8.23 2.97 8.23 3.09 400.00 3.09 400.00 3.10 400.00 3.10 400.00 3.10 400.00 3.10 400.00 3.11 400.00 3.11 400.00 3.11 400.00 3.11 400.00 3.12 400.00 3.12 400.00 3.12 400.00 3.12 400.00 3.13 400.00 3.13 400.00 3.13 400.00 3.13 400.00 3.14 105.26 3.14 105.26 3.15 105.26 3.16 105.26 3.17 105.26 3.18 105.26 3.19 105.26 3.20 105.26 3.21 105.26 3.22 105.26 3.23 400.00 3.23 400.00 3.24 400.00 3.24 400.00 3.24 400.00 3.24 400.00 3.25 400.00 3.25 400.00 3.25 400.00 3.25 400.00 3.26 400.00 3.26 400.00 3.26 400.00 3.26 400.00 3.27 400.00 3.27 400.00 3.27 400.00 3.27 400.00 3.28 400.00 3.28 400.00 3.28 400.00 3.28 400.00 3.29 400.00 3.29 400.00 3.29 400.00 3.29 400.00 3.30 400.00 3.30 400.00 3.30 400.00 3.30 400.00 3.31 400.00 3.31 400.00 3.31 400.00 3.31 400.00 3.32 400.00 3.32 400.00 3.32 400.00 3.32 400.00 3.33 400.00 3.33 400.00 3.33 400.00 3.33 400.00 3.34 400.00 3.34 400.00 3.34 400.00 3.34 400.00 3.35 400.00 3.35 400.00 3.35 400.00 3.35 400.00 3.36 400.00 3.36 400.00 3.36 400.00 3.36 400.00 3.37 400.00 3.37 400.00 3.37 400.00 3.37 400.00 3.38 400.00 3.38 400.00 3.38 400.00 3.38 400.00 3.39 400.00 3.39 400.00 3.39 400.00 3.39 400.00 3.40 400.00 3.40 400.00 3.40 400.00 3.40 400.00 3.41 400.00

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^2: Morse code via sound card input
by GrandFather (Saint) on Jul 09, 2007 at 23:07 UTC

    Using an FFT is probably counter productive. One cycle of 400 Hz is 2.5 ms so your 5 ms "tone" comprises just two cycles! It's computationally much easier to time "zero" crossings (with a modest amount of hysteresis) and that is likely to work pretty well for fairly clean signals. By the time you have to start digging into the noise to retrieve the signal things get a whole lot trickier.

    Note that a 5 ms dot time represents 240 words per minute. More achievable speeds are less than 1/10th of that. For test purposes around 5 words per minute with a Farnsworth speed of around 12 wpm is fairly typical.


    DWIM is Perl's answer to Gödel
      It's computationally much easier to time "zero" crossings

      Well actually I did use that method from toma's Freqext.pm module at analyzing wavs with Perl under the section "Tracking Frequency by Finding Zero Crossings". I may have mislead you above where I said I used FFT.


      I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re^2: Morse code via sound card input
by ww (Archbishop) on Jul 09, 2007 at 21:16 UTC
    So, if I read this correctly, starting at the top, we have

    a dit of five-plus miliseconds of 400Hz (0.00 through 0.05),
    followed by an intercharacter break of eight-plus ms of 105.26Hz (audible, but unlikely to be confused with 400Hz),
    followed by a dah of something like 18 ms of 400Hz,
    followed by a pause of 109 ms at 8.23 Hz (inaudible even to dogs, I think),
    ... and so on.

    The 5+ to 18 is close for the 3:1 dit:dah ratio. the inter-character break of 8 ms doesn't fit so well; and the pause (inter-word break?) is not even close to the 1:7... but maybe it wasn't intended to be. But the next "A" fits less well.

    So, if typical CW is like your sample, my theories go up in smoke ...which HAS happened before :-).