in reply to Morse code via sound card input
Re the definitions, from http://www.journal.au.edu/ijcim/jan99/ijcim_ar1.html
"A tone ratio (dot to dash) has to be 1:3 according to the definition of Morse code. That means if the duration of a dash (sic. I think this should be dih or dit or dot. ww) is taken to be one unit, then that of a dash is three units. In addition, the silent ratio (dot-space : character-space : word-space) has to be 1:3:7. In another words, the space between the components of one character is one unit, between characters is three units and between words is seven units."
Another way of looking at the ratios is expounded at
http://www.arsqrp.com/ars/pages/back_issues/2000_text/1200_text/morse.htmlwhere the author begins with this background:
"There is a clock running . . . tick tick tick . . . with a constant time between each tick (for a given fixed Morse speed)."
and proceeds to assert:
"Definition: WEIGHT is the percent of time a signal is found in a timeslot.
"Definition: A DOT is a timeslot filled 100% by a signal/key down/Mark.
....
"Theorem (Truth): The WEIGHT of a DOT is 100%.
"Definition: A SPACE is a 100% empty timeslot.
"Let's solve the mess with these definitions:
"Definition: A DIT is a DOT followed immediately by a SPACE.
"Theorem (Truth): The duration of a DIT is two timeslots.
"Definition: A DAH is a DASH followed immediately by a SPACE.
"Theorem (Truth): The duration of a DAH is four timeslots.
"The truth of all this lies in the fact that we do NOT learn the Morse Code in DOTs and DASHes, rather we learn it using DITs and DAHs! We MUST have the trailing SPACE at the end of DOTs and DASHes to distinguish one in time from the other. Built in spacing!"
As both Zentara and Grandfather noted (above), the keying of an individual character or space may vary with physical condition, the sender's "sense of rhythm" and code skills, the inherent difficulty of particular characters (think about trying to type "~!" which -- at least on a US standard keyboard requires what I find to be an awkward shift of the left little finger to the left-shift-key and of the ring-finger [which is substituting for the little finger], first to the tilde and then to the bang), and "over time" in addition to what are likely many other factors.
That's certainly going to make recognizing manual keying difficult. One -- very complicated -- solution might involve creating a hash of character sequences with values for some empirically-identified, typical-variances from "standard Morse." Alternately (and this is merely lurking in some corner of my brain that I can't quite surface), might it not be possible to use modulus division, testing for each of the ratios above, and from the value of the remainder, make some pretty good guesses about the sender's intentions?
However, the OP's case ("I want to write a perl script that can interpret morse code from the sound card's mic input (so the script can be used with a keyer)" (emphasis supplied) appears simpler. Were one to try to extend this for broacast reception -- that is, the Morse found in the wild -- one may wish to note that very few HAM operators use traditional hand keying any more; rather, even if they use a traditional key (the OP's case) they also use automation to convert the input of the keying devices to output CW that more nearly matches the Morse spec.
And in the case of machine-generated Morse (think weather, navaids, and bulk commercial comms) the translation program would not have to deal with the detractors induced by hand keying; at least, not significantly over a short (values less than a few minutes, I would think) period. In that case, the chief preliminary work of a translation program would be identifying the duration of the dit, the basic unit for all the work that follows.
Caveat: Farnsworth Morse, widely used, "is composed of higher speed characters sent with longer than standard spacing between them."
Also cf Ming-Che Hsieh; Ching-Hsing Luo re "an interactive training approach implemented on a single-chip microcomputer with immediate visual and auditory feedback...." at
(unfortunately, $$$) http://www.informaworld.com/smpp/content~content=a714043328~db=all
... and Ming-Che Hsieh & Ching-Hsing Luo re "Automatic Morse code recognition with adaptive variable-ratiothreshold prediction" at
http://ieeexplore.ieee.org/Xplore/login.jsp?url=/iel5/6513/17397/00802743.pdf?arnumber=802743
"In this study, an Adaptive Variable-Ratio Threshold Prediction (AVRTP) algorithm is proposed to analyze the Morse code time series with variable unit time period and ratio. Two least-mean-square (LMS) predictors are applied to trace the dot interval and the dot-dash difference concurrently, and then a predicted threshold based on a variable-ratio decision rule is used to distinguish between dots and dashes. The same method is also applied to identify the character-space..."
So, achieving the OP's objective will definitely require a non-trival script, it does NOT seem out of the category "do-able with intermediate Perl skills."
Update: un-linkified a bracketed remark inside parens. Duh.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Morse code via sound card input
by zentara (Cardinal) on Jul 09, 2007 at 16:58 UTC |