I’ve used a simple variable length Huffman encoding. As the dot is the most common symbol in morse, we encode as:
dot (“.”) 0
dash (“-”) 10
space (“ ”) 11
Thus the letters of “hi there” are encoded in Morse as:
.... .. - .... . .-. .
which then would be encoded in bits as:
Broken up into bytes, MSB first, and padded with space symbols at the end, this gives
00001100 11111110 11000011 01101001 10111111
which in hex is 0x0CFEC369BF
For simplicity, the encoder program encodes any non-alphabetic character in the input file as
if it were a space character (ie 111111 in binary).
Attached is the C source code for a Morse Code encoder using this encoding.
I can use some of the source code from the encoder in such as opening and writing to a file.
I want to change the encoding functions to read bytes from that encoded message and look at the bits. And if you get a 0 then its a ".", if you get a 10 its a "-"etc. Then you compare the string you have against the table; so if you have .- then it will be substituted by an A, -... = B etc. Can sompne please help me with this?