blog

2018-03-13

Computer Tools for Morse Code Practice

While there are websites that provide practice Morse code transmissions, I wanted more control and flexibility. So I wrote a set of four command-line tools for Mac and Linux:

These have been tested on macOS 10.12 and CentOS 7.

The mbeep tool is responsible for producing Morse code tones and sending to audio output or to a .wav file. For example, to play the Morse code for "Computer Tools for Morse Code Practice" through the audio output device, type:

mbeep -c "Computer Tools for Morse Code Practice"

To save Morse code for the same text to a .wav file, type:

mbeep -o foo.wav -c "Computer Tools for Morse Code Practice"

Click to hear it:

Amateur radio operators are familiar with problem of key clicks, which result from too rapidly switching a radiofrequency signal on and off. The same problem can be heard when an audio signal is abruptly turned on or off. To improve the sound quality of the Morse code tones, mbeep applies a sinusoidal ramp up and ramp down factor to each tone:

dit waveform

randwords generates a series of random words drawn from a list of the most common 5000 English words. Options allow for selecting how many words are generated and which portion of the list should be used. This example shows generation of 40 words from the most common 100 words:

$ randwords -n 40 -t 100
was me great an some
what any those should up
they he the after being
first on much for well
but made will that is
only and same not about
between be now two of
many into no were in

codegroups generates a series of random 5-character code groups. The characters are randomly chosen from those required by the last remaining FCC code test (the commercial Radiotelegraph Operator License). mbeep interprets = as the prosign [BT], + as the prosign [AR], and * as the prosign [SK]. This example shows generation of 40 code groups:

$ codegroups -n 40
Z7+LV 0NRFN ,DHYR BON76 SCGEQ GY8AX 9QLT* 6L*JK
/IVCU B131N KS9?L A,M8T JW0I+ WMH4J CF=J1 V9BX0
X..SU DQ55L Z3RCU 0I2TK G3.Z4 I+.94 9OEL3 4C0FX
G6FFA +4?+O +HKS* N.WM* ANQ8E 8MJ=O R+D8* 8U,4K
=HTK7 +4SE. DT*6S 78,3M 7J*?C I,ZO2 1A163 QJ/SN

The codegroups and randwords commands can be piped to mbeep to play the sounds directly:

randwords -n 40 -t 100 | mbeep -I -c

codegroups -n 40 | mbeep -I -c
 

Although mbeep can accept a text file as input, it may be the case that an unmodified text file is not immediately suitable. Only a small group of punctuation marks are required by the FCC test or used in common radio practice. The morsefeed tool filters text files to produce practice text that uses only the standard set of characters.

Additionally, morsefeed can download web pages, filter out HTML tags, and send the text directly to mbeep. There are some text-only news websites that are a good source of constantly-changing practice text. Examples:

$ # Send first chapter of A Tale of Two Cities to mbeep
morsefeed -u https://7402.org/files/tale2c.txt -m

# Send current NPR news articles to mbeep
morsefeed -u http://text.npr.org/ -a "Top News Stories" -b "<p>Topics</p>" -L -A "Home</a>" -B "About NPR</a>" -m

Mac installation instructions for the tools are available here. Mac and Linux build instructions are on github.com. Full documentation for each tool is available via their man pages:

man mbeep
man codegroups
man randwords
man morsefeed

Questions? Send email.