mltmorse is a library for Morse encoding/decoding and signal sound generation.
This repository is forked from gSpera/morse.
- Encoding of strings and decording of Morse code
- Encording of several types of characters (Latin,Greek,Cyrillic)
- Specify Morse code conversion table
The standard supported conversion tables are as follows
- Latin, Symbol, Number: ITU-R M.1677-1
- Greek: decodemorsecode.com
- Korean: SKATS,mykit.com
- There is a problem where Hangul characters cannot be properly normalized, thereby causing encoding/decoding to fail.
- Japanese: The Japen Amateur Radio League
You can also define a conversion table and use your own as shown below. Depending on the characters you want to use, you may need to define a function to normalize the string before converting it to Morse code.
var LatinMorse = mltmorse.EncodingMap{
'A': ".-",
'B': "-...",
'C': "-.-.",
'D': "-..",
'E': ".",
...
}
You can find a cli tool in the cmd/morsecli directory This tool can be used for converting to/from morse and generating CW
$ morsecli -s lt > out.morse
test
this is morse.
^C
$ cat out.morse
- . ... - .-.-- .... .. ... .. ... -- --- .-. ... . .-.-.- .-.-
$ morsecli -D < out.morse
TEST
THIS IS MORSE.
For more uses look use --help
text := "MORSE IS AWESOME"
//Convert to morse
textInMorse := morse.ToMorse(text)
fmt.Println(textInMorse) //-- --- .-. ... . .. ... .- .-- . ... --- -- .
//Back to text
backToText := morse.ToText(textInMorse)
fmt.Println(backToText) //MORSE IS AWESOME