morse
Convert text to Morse code
SYNOPSIS
morse [options] [text_or_morse_input]
PARAMETERS
-h, --help
Displays a help message outlining the command's syntax and options.
-v, --version
Shows the version information for the morse utility.
-d, --decode
Instructs morse to decode the input from Morse code to plain text. By default, it encodes text to Morse.
-t, --text
Explicitly specifies that the input is plain text. This is often the default mode of operation when encoding.
-m, --morse
Explicitly specifies that the input is Morse code for decoding.
-s, --sound
Plays the generated Morse code as audible tones. This option often requires additional parameters for controlling sound characteristics.
-w WPM, --wpm=WPM
Sets the words per minute (WPM) for generating or playing Morse code, affecting the speed of the output. This is typically used with the --sound option.
-f FREQ, --frequency=FREQ
Specifies the frequency (in Hertz) of the audible tones when playing Morse code. Used with --sound.
-S MILLISECONDS, --speed=MILLISECONDS
Sets the duration of a single "dit" (dot) in milliseconds. This is an alternative way to control speed, often overriding WPM settings.
-o FILE, --output=FILE
Redirects the output (either Morse code or decoded text) to the specified FILE instead of standard output.
DESCRIPTION
The morse command is a command-line utility designed to convert plain text into International Morse code sequences, typically represented by dots (.), dashes (-), and spaces. It can also perform the reverse operation, decoding Morse code representations back into human-readable text. Beyond simple conversion, many implementations of morse offer the ability to play the generated Morse code as audible tones through the system's sound device, allowing users to hear and practice Morse code. This makes it a valuable tool for amateur radio enthusiasts, learners, and anyone interested in communication signals. The command typically reads input from standard input or a specified file and writes the output to standard output or an output file. It supports various parameters to control aspects like output speed (words per minute), sound frequency, and input/output formats.
CAVEATS
Sound capabilities might depend on the underlying audio system (e.g., ALSA, PulseAudio) and available speakers or headphones. Some systems might require additional audio utilities to be installed or configured correctly.
The exact set of options and their behavior can vary slightly between different implementations or versions of the morse command. The information provided here is common to many versions, particularly those based on the `morse-converter` package.
Character support is typically limited to basic Latin alphabet characters, numbers, and some common punctuation. Extended Unicode characters are generally not supported, and international Morse code often has specific adaptations for non-English characters.
MORSE CODE REPRESENTATION
The command typically represents a dot as a single period (`.`), a dash as a hyphen (`-`), and spaces between letters or words using single or triple spaces, respectively. For example, the word "SOS" would be represented as `... --- ...` when encoded.
INPUT HANDLING
When reading input, morse often processes it line by line from standard input or a specified file. For decoding, it expects valid Morse code sequences separated by spaces between characters and typically three spaces between words. Invalid characters in either input mode may be ignored or result in errors, depending on the implementation.
INTERNATIONAL MORSE CODE
The morse command generally adheres to the International Morse Code standard, which defines the precise sequences of dots and dashes for letters, numbers, and punctuation. This standard ensures compatibility and universal understanding among Morse code users.
HISTORY
While Morse code itself was invented in the 1830s, command-line utilities like `morse` on Linux are much more recent, emerging as simple programming exercises or specialized tools for amateur radio and communications. Implementations, such as the `morse-converter` package, aim to provide a straightforward way to interact with Morse code for educational, recreational, and practical purposes within the Unix-like environment, often leveraging standard system libraries for text processing and sound output. Their development is typically driven by individual developers or small communities focused on utility and accessibility.