Author image

Morse Code Converter


Difficulty:
1/5


A Morse Code Converter converts a given input string to Morse Code based sounds. Morse code is a telecommunication method used to encode text characters as sequences of different signal durations called dots and dashes.

Working algorithm is straightforward to program:

  1. prompts the user to enter a text string
  2. it decodes the text string to individual characters and maps them to the right combination of the 2 morse code characters according to the International Morse Code table below.
  3. it uses the WinApi Beep function (in 1kHz arrangement) to play the . or the - sound. Traditionally the dash has a longer sound duration so I use 240ms for a dash's playback and 80ms for a dot' playback (3x).

I know Beep is considered old, but is still very much functional and used. In Windows 7 Beep was rewritten to pass the beep to the default sound device for the session. So for this simple application it should be more than adequate.

international morse code

Image source: Wikipedia.

Github

Github repository link.


0 likes