cwcp is a curses-based interactive Morse code tutor program. It allows menu selection from a number of
sending modes, and also permits character sounding options, such as the tone pitch, and sending speed, to
be varied from the keyboard using a full-screen user interface.
COMMANDLINEOPTIONScwcp understands the following command line options. The long form options may not be available in non-
LINUX versions.
-s,--system=SYSTEM
Specifies the way that cwcp generates tones. Valid values are: null for no tones, just timings,
console for tones through the console speaker, alsa for tones generated through the system sound
card using ALSA sound system, oss for tones generated through system sound card using OSS sound
system, pulseaudio for tones generated through system sound card using PulseAudio sound system,
soundcard for tones generated through the system sound card, but without explicit selection of
sound system. These values can be shortened to 'n', 'c', 'a', 'o', 'p', or 's', respectively. The
default value is 'pulseaudio'.
-d,--device=DEVICE
Specifies the device file to open for generating a sound. cwcp will use default device if none is
specified. The default devices are: /dev/console for sound produced through console, default for
ALSA sound system, /dev/audio for OSS sound system, adefaultdevice for PulseAudio sound system.
See also NOTESONUSINGASOUNDCARD below.
-w,--wpm=WPM
Sets the initial sending speed in words per minute. The value must be between 4 and 60. The
default value is 12 WPM.
-t,--tone=HZ
Sets the initial sounder pitch in Hz. This value must be between 0 and 4,000. A value of 0
selects silent operation, and can be used for timing checks or other testing. The default value
is 800Hz,
-v,--volume=PERCENT
Sets the initial sending volume, as a percentage of full scale volume. The value must be between
0 and 100. The default value is 70 %. Sound volumes work fully for sound card tones, but cwcp
cannot control the volume of tones from the console speaker. In this case, a volume of zero is
silent, and all other volume values are simply sounded.
-g,--gap=GAP
Sets the initial extra gap, in dot lengths, between characters (the 'Farnsworth' delay). It must
be between 0 and 60. The default is 0.
-k,--weighting=WEIGHT
Sets the initial weighting, as a percentage of dot lengths. It must be between 20 and 80. The
default is 50.
-T,--time=TIME
Sets the initial practice time, in minutes. cwcp stops after generating random Morse code for
this period. The value must be between 1 and 99. The default is 15 minutes.
-f,--infile=FILE
Specifies a text file that cwcp can read to configure its practice text. See CREATINGCONFIGURATIONFILES below.
-F,--outfile=FILE
Specifies a text file to which cwcp should write its current practice text.
-h,--help
Prints short help message.
-V,--version
Prints information about program's version, authors and license.
USERINTERFACEcwcp is a curses-based program that takes over the complete operation of the terminal on which it is run.
If colours are available on the terminal, it will produce a colour interface.
The cwcp screen is divided into several distinct areas:
TheMenuSelectionwindow
The Menu Selection window shows the main modes that cwcp offers. Use the F10 and F11 or KEY_DOWN
and KEY_UP keys to select the mode. F9 or Return start sending, and F9 again or Esc stop sending.
Changing mode also stops sending.
TheMorseCodeDisplaywindow
This window displays each Morse code character after it has been sent.
TheSpeedControlwindow
The Speed window shows the current Morse code sending speed in words per minute. Pressing the F2
or KEY_RIGHT keys increases the speed; pressing the F1 or KEY_LEFT keys decreases the speed.
TheToneControlwindow
This window shows the current Morse code tone pitch. Use the F4 or KEY_HOME key to increase the
pitch, and the F3 or KEY_END key to decrease it. Values change in steps of 20Hz.
TheVolumeControlwindow
This window shows the current Morse code volume. Use the F6 key to increase the volume, and the
F5 key to decrease it. Values change in steps of 1%. Note that cwcp cannot control the volume of
the console speaker, so the volume control only works effectively for tones generated on the sound
card.
TheGapControlwindow
This window shows the current additional 'Farnsworth' gaps to be appended after each Morse code
character is sounded. Use F8 to increase the gap, and F7 to decrease it.
TheTimeControlwindow
This window shows the selected practice time. After generating Morse code in a particular mode
for this amount of time, cwcp stops automatically. Use KEY_NPAGE to increase the time, and
KEY_PPAGE to decrease it. During sending, the value in this window counts down to one, and after
final minute of sending has elapsed, cwcp stops sending. The timer operates like a microwave or
kitchen timer; it counts down on its own, but the time remaining can also be altered manually
while the timer operates.
The following keys vary the screen colours:
{key Changes the foreground colour of the window boxes.
}key Changes the background colour of the window boxes.
[key Changes the foreground colour of the window contents.
]key Changes the background colour of the window contents.
Eight screen colours are available for each: black, red, green, yellow, blue, magenta, cyan, and white.
Use a key to cycle round these colours for the particular part of the display controlled by that key. On
a change of colours, the complete screen is repainted.
Use Ctrl-L to repaint the complete screen, in case of screen corruption. Use Ctrl-V to clear the Morse
Code Display Window. This command is available only when cwcp is not sending.
To leave cwcp, press F12 or Ctrl-C, or select Exit on the mode menu.
All of the above command keys may be used while random characters are being sent, and when keyboard input
is being sent.
If function keys are not available on the terminal, Ctrl-<key> combinations can be used. On the top row
of letter keys on the keyboard, the keys Ctrl-Q to Ctrl-I may be used as alternatives for F1 to F8, and
on the second row of letter keys, Ctrl-A to Ctrl-F as alternatives for F9 to F12. For KEY_PPAGE and
KEY_NPAGE, use Ctrl-O and Ctrl-P.
RANDOMCHARACTERSANDWORDScwcp sends random characters in groups of five, with a space between each group. After a period of
sending, set in the TimeControlwindow, cwcp stops automatically. It can also be stopped manually,
before this time period expires.
When sending random words, cwcp sends the complete word, followed by a space. Because short words are
easier to copy without writing, cwcp's default dictionary contains only three, four, and five-letter
words in its random words list.
cwcp chooses at random from a list of around 3000 words in its default dictionary. You can change this
text using a configuration file, read at startup. See CREATINGCONFIGURATIONFILES below.
NOTESONUSINGASOUNDCARD
By default, cw tries to open default PulseAudio. If PulseAudio server is not accessible, cw tries to open
OSS device "/dev/audio" to access the system sound card. This is generally the correct device to use,
but for systems with special requirements, or those with multiple sound cards, the option -d or --device,
combined with -s or --system can be used to specify the device and sound system for sound card access.
If the sound card device cannot be set up, cwcp prints the error message
cannot set up soundcard sound
and exits.
Sound card devices, when opened through OSS sound system, are usually single-access devices, so that when
one process has opened the device, other processes are prevented from using it. In such cases cwcp will
of course conflict with any other programs that expect exclusive use of the system sound card (for
example, MP3 players). If cwcp finds that the sound card is already busy, it prints the error message
open /dev/audio: Device or resource busy
and exits.
The sound card device is not used if cwcp is only sending tones on the console speaker.
SOUNDOUTPUT-DEFAULTSANDSELECTIONcwcp first tries to access sound card using PulseAudio sound system, using default device name, unless
user specifies other sound device with option -d or --device.
cwcp then tries to access sound card using OSS sound system and default OSS sound device name
('/dev/audio'), unless user specifies other sound device with option -d or --device.
If opening soundcard through OSS fails, cwcp tries to access the sound card using ALSA sound system, and
default ALSA sound device name ('default'), unless user specifies other sound device with option -d or
--device.
If opening soundcard through ALSA also fails, cwcp tries to access system console buzzer using default
buzzer device '/dev/console', unless user specifies other sound device with option -d or --device.
It is very common that in order to access the console buzzer device user has to have root privileges.
For that reason trying to open console buzzer almost always fails. This is not a program's bug, this is
a result of operating system's restrictions. Making cwcp an suid binary bypasses this restriction. The
program does not fork() or exec(), so making it suid should be relatively safe. Note however that this
practice is discouraged for security reasons.
As stated, user can tell cwcp which device to use, using -d or --device option. Which device files are
suitable will depend on which operating system is running, which system user ID runs cwcp, and which user
groups user belongs to.
CREATINGCONFIGURATIONFILEScwcp contains a default set of modes and practice text that should be enough to begin with. It can
however read in a file at startup that reconfigures these to provide different character groupings, word
sets, and other practice data.
To read a configuration file, use the -f or --infile command line options. The file should introduce
each cwcp mode with a section header in '[' ... ']' characters, followed by the practice text for that
mode, with elements separated by whitespace. Lines starting with a semicolon or hash are treated as
comments. For example
; Simple example mode
[ A to Z ]
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
cwcp will generate five character groups for modes whose elements are all single characters, and treat
other modes as having elements that are complete words. As a starting point for customized modes, cwcp
will write its default configuration to a file if given the undocumented -# option, for example "cwcp -#
/tmp/cwcp.ini".