Skip to content
forked from gSpera/morse

A Golang library for Morse encoding / decoding for multi-alphabets

License

Notifications You must be signed in to change notification settings

Kipprotor/mltmorse

 
 

Repository files navigation

mltmorse

Documentation Go Report Card

mltmorse is a library for Morse encoding/decoding and signal sound generation.

This repository is forked from gSpera/morse.

Features

  • Encoding of strings and decording of Morse code
  • Encording of several types of characters (Latin,Greek,Cyrillic)
  • Specify Morse code conversion table

Support

The standard supported conversion tables are as follows

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': ".",
  ...
}

Tool

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

Examples

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

About

A Golang library for Morse encoding / decoding for multi-alphabets

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.2%
  • Shell 1.8%