1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580
|
.\"
.\" UnixCW CW Tutor Package - CW
.\" Copyright (C) 2001, 2002 Simon Baldwin (simonb@caldera.com)
.\"
.\" This program is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU General Public License
.\" as published by the Free Software Foundation; either version 2
.\" of the License, or (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public License
.\" along with this program; if not, write to the Free Software
.\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.\"
.\"
.TH CW 1 "CW Tutor Package" "G0FRD" \" -*- nroff -*-
.SH NAME
.\"
cw \- sound characters as Morse code on the soundcard or console speaker
.\"
.\"
.\"
.SH SYNOPSIS
.\"
.B cw
[\-s \fIsound\fP] [\-\-sound=\fIsound\fP]
[\-x \fIsdevice\fP] [\-\-sdevice=\fIsdevice\fP]
[\-y \fImdevice\fP] [\-\-mdevice=\fImdevice\fP]
[\-d \fIcdevice\fP] [\-\-cdevice=\fIcdevice\fP]
[\-f \fIfile\fP] [\-\-file=\fIfile\fP]
[\-w \fIWPM\fP] [\-\-wpm=\fIWPM\fP]
[\-t \fItone\fP] [\-\-tone=\fItone\fP] [\-\-hz=\fItone\fP]
[\-v \fIvolume\fP] [\-\-volume=\fIvolume\fP]
[\-g \fIgap\fP] [\-\-gap=\fIgap\fP]
.BR
[\-e] [\-\-noecho]
[\-m] [\-\-nomessages]
[\-c] [\-\-nocommands]
[\-o] [\-\-nocombinations]
[\-p] [\-\-nocomments]
.BR
.PP
.B cw
also accepts the \-h, \-\-help, \-V and \-\-version options.
.PP
The LINUX version understands both short form and long form command
line options. Other versions understand only the short form options.
.PP
Options may be predefined in the environment variable \fBCW_OPTIONS\fP.
If defined, these options are used first; command line options take
precedence.
.PP
.\"
.\"
.\"
.SH DESCRIPTION
.\"
.PP
.B cw
reads characters from an input file, or from standard input, and sounds
each valid character as Morse code on either the system sound card, the
system console speaker, or both. After it sounds a character, \fBcw\fP
echoes it to standard output. The input stream can contain embedded
command strings. These change the parameters used when sounding the
Morse code.
.B cw
reports any errors in embedded commands on standard error.
.PP
.\"
.\"
.\"
.SS COMMAND LINE OPTIONS
.\"
.B cw
understands the following command line options. Only the short form
options are available in non-LINUX versions.
.TP
.I "\-s, \-\-sound"
Specifies the way that \fBcw\fP generates tones. Valid values
are 'soundcard' for tones through the system sound card, 'console'
for tones through the console speaker, or 'both'. These may be shortened
to 's', 'c', or 'b'. The default value is 'soundcard'.
.TP
.I "\-x, \-\-sdevice"
Specifies the device file to open for access to the sound card. The
default device is \fI/dev/dsp\fP, and this is generally the correct
device on most systems. See \fINOTES ON USING A SOUND CARD\fP below.
This option is invalid if \fBcw\fP is generating tones only on the
console.
.TP
.I "\-y, \-\-mdevice"
Specifies the device file to open for access to the sound mixer. The
default device is \fI/dev/mixer\fP. See \fINOTES ON USING A SOUND CARD\fP
below. This option is invalid if \fBcw\fP is generating tones only on
the console.
.TP
.I "\-d, \-\-cdevice"
Specifies the device file to open for sound using the console speaker.
The default device here is \fI/dev/tty1\fP, which is only marginally
likely to be correct on Linux, and most likely incorrect on other
platforms. In general, it is likely to be necessary to provide a
suitable value for this option if console sound is selected. The
value should be a console device file, capable of KIOCSOUND.
See \fISELECTING SUITABLE SOUND DEVICE FILES\fP below. This option is
invalid if \fBcw\fP is generating tones only on the soundcard.
.TP
.I "\-f, \-\-file"
Specifies the input file to open. The default input file is standard
input.
.TP
.I "\-w, \-\-wpm"
Sets the initial sending speed in words per minute. The value must be
between 4 and 60. The default value is 12 WPM.
.TP
.I "\-t, \-\-hz, \-\-tone"
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,
.TP
.I "\-v, \-\-volume"
Sets the initial sending volume, as a percentage. The value must be
between 0 and 100. The default value is 70 %. Sound volumes work
fully for sound card tones, but \fBcw\fP 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.
.TP
.I "\-g, \-\-gap"
Sets the initial extra gap, in dot lengths, between characters
(the 'Farnsworth' delay). It must be between 0 and 20. The default
is 0.
.TP
.I "\-e, \-\-noecho"
Stops \fBcw\fP echoing characters on standard output after they are
sounded. The default is to have echoing on.
.TP
.I "\-m, \-\-nomessages"
Stops \fBcw\fP printing error messages on standard error.
The default is to print messages.
.TP
.I "\-c, \-\-nocommands"
Stops \fBcw\fP from interpreting commands embedded in the input stream.
The default is to interpret embedded commands.
.TP
.I "\-o, \-\-nocombinations"
Stops \fBcw\fP from treating character strings bracketed by [...] as
a single combination character. The default is to honour combinations.
.TP
.I "\-p, \-\-nocomments"
Stops \fBcw\fP from treating character strings bracketed by {...} as
'comments'; characters inside these braces will be echoed to standard
output, but not sounded. When comments are being honoured, any
embedded commands inside the braces will be ignored. The default is
to honour comments.
.PP
.\"
.\"
.\"
.SS SOUNDING CHARACTERS
.\"
.B cw
reads characters, one at a time, from its standard input or from its
input file. Lowercase letters are converted internally to uppercase.
The following list shows the valid IS0 8859-1 (Latin-1) characters that
can be sounded by \fBcw\fP:
.IP
ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"$()+\-./:;=?_ and space
.PP
In addition, the program also understands the following ISO 8859-1
and ISO 8859-2 accented characters:
.IP
Ѫ
.PP
See \fBcw\fP(7,LOCAL) for more information on the above characters
and Morse code.
.PP
If \fBcw\fP receives a character not in this set, it prints an error
message '?\fIc\fP', where \fIc\fP is the error character. The only
exceptions to this may be the \fBcw\fP command escape character '@',
the combination start and stop characters '[' and ']', and the
comment start and stop characters '{' and '}'.
See \fIEMBEDDED COMMANDS\fP and \fIMORSE CODE COMBINATIONS\fP below.
.PP
.\"
.\"
.\"
.SS EMBEDDED COMMANDS
.\"
.B cw
recognises special sequences in the input stream as embedded commands.
These commands alter the parameters of the \fBcw\fP while it is
running, or query current values. All commands are prefixed by the
command escape character '@', and those which set a value end with a
semicolon.
.PP
The format of an embedded command to change a parameter value is
.IP
\@\fICvalue\fP;
.PP
where \fIC\fP is a command letter indicating what action \fBcw\fP
is to take, and \fIvalue\fP is the argument or value for the command.
.PP
Valid command letters are
.TP
.I "T"
Resets the tone pitch used to sound a character.
.TP
.I "W"
Resets the sending speed.
.TP
.I "G"
Resets the 'Farnsworth' gap between characters.
.TP
.I "E"
Disables or re-enables echoing of sent characters on standard output.
.TP
.I "M"
Disables or re-enables error messages on standard error.
.TP
.I "S"
Disables or re-enables speaker tone generation.
.TP
.I "C"
Disables processing of embedded commands. Note that once disabled,
this command cannot re-enable them.
.TP
.I "O"
Disables or re-enables recognition of [...] character combinations.
.TP
.I "P"
Disables or re-enables recognition of {...} comments. When comments
are being recognised, any character after an opening '{' and before
any closing '}' will be echoed to standard output, but will not be
sounded, or have any other effect.
.PP
For example, the embedded command sequence
.IP
\@W25;@T1200;
.PP
will set \fBcw\fP to a speed of 25 WPM, and a tone pitch of 1200Hz.
.PP
The 'T', 'W', 'G', and 'A' commands take values along with the command.
The limits on values given for embedded commands are the same as the
limits available for command line options, detailed above.
.PP
The 'E', 'M', 'S', 'C' and 'O' commands are flags, and treat a value of
zero as clear, and any other value as set. So, for example, the sequence
.IP
\@M0;@C0;
.PP
will turn off error messages, and then turn off the processing of
embedded commands.
.PP
If a parameter is set successfully, \fBcw\fP reports the new setting on
standard error (except if no error messages is set). If an error is
detected in an embedded command, \fBcw\fP reports an error. For the
formats of error messages see the \fIMESSAGE FORMATS\fP section below.
.PP
The current values of parameters within \fBcw\fP may be queried,
as well as set. The command format
.IP
\@?\fIC\fP
.PP
queries the value of the parameter normally set with command \fIC\fP.
.B cw
reports the current value on standard error, using the same format
as when new values are set.
.PP
The current values of parameters within \fBcw\fP may also be requested
as output in Morse code. The command format
.IP
\@>\fIC\fP
.PP
will generate Morse output reporting the value of the parameter
normally set with command \fIC\fP.
.PP
If embedded commands are disabled, '@' characters are treated as any
other (in this case, invalid) input character.
.PP
Once processing of embedded commands has been switched off, any
command to switch this feature back on will not be recognised; that
is, after '@C0;', an '@C1;' will not be recognised.
.PP
There is one additional command, and that is '@Q'. This command
closes all open files and terminates \fBcw\fP. Any characters after
this command in the input stream will be lost.
.PP
The file \fIcw.h\fP provides a full set of definitions for the
commands, special characters, and status codes of \fBcw\fP.
.PP
.\"
.\"
.\"
.SS MESSAGE FORMATS
.\"
Where a parameter value is set correctly with an embedded command, the
message format
.IP
\=\fICvalue\fP
.PP
is returned. \fIC\fP is the command used, and \fIvalue\fP is the
new value.
.PP
If an invalid value is supplied for a parameter in an embedded
command, a message
.IP
?\fICvalue\fP
.PP
is returned.
.PP
Where an invalid command is encountered, the message format
.IP
?@\fIC\fP
.PP
is used. For an invalid query, the message is
.IP
??\fIC\fP
.PP
and for an invalid request for a parameter in Morse code the message
is
.IP
?>\fIC\fP
.PP
A character in the input stream that cannot be sounded produces a
message
.IP
?\fIC\fP
.PP
These messages are not intended to be user-friendly, but are designed
to be easily and quickly interpreted by another program. Similarly,
the format of embedded commands is more computer-friendly than
user-friendly.
.PP
If error messages are disabled, no messages of any type are printed on
standard error.
.PP
.\"
.\"
.\"
.SS MORSE CODE COMBINATIONS
.\"
The standard set of characters offered by \fBcw\fP may not be sufficient
for some purposes. For example, certain procedural signals, such as VA
(also known as SK), have no ASCII equivalent, and \fBcw\fP cannot
therefore sound them directly.
.PP
To help in sounding such characters, \fBcw\fP offers the ability to form
combination characters by placing individual character components
between [...] brackets. \fBCw\fP sounds characters inside a combination
without the usual gap between them. In this way, any missing character
in the set can be built.
.PP
Note that it's usually correct for timing purposes to place the final
character of a combination outside the [...] brackets, otherwise the gap
that would normally appear between the combination character and the next
character to be sent is lost.
.PP
For example
.IP
[V]A
.PP
is one way to form the VA procedural signal, though
.IP
[S]K
.PP
works just as well. The eight-dot error signal can be sounded with
.IP
[HS]E
.PP
or the C-cedilla in international Morse code with
.IP
[C]E
.PP
There can be as many valid letters, numbers, or figures inside the [...]
brackets as required. For example, an alternative way of sending the
error signal could be
.IP
[EEEEEEE]E
.PP
Finally, three alternative ways of sending 73 might be
.IP
[TTEE]E[EEET]T
.br
[TD]E[EU]T
.br
[GE]E[V]T
.PP
Embedded commands may be placed inside [...] combinations if required.
Combinations do not nest.
.PP
This feature can be disabled by using the \fI\-O\fP
or \fI\-\-nocombinations\fP command line flags, or with the 'O' embedded
command. If combinations are disabled, '[' and ']' characters are treated
as any other (invalid) input character.
.PP
.\"
.\"
.\"
.SS NOTES ON USING A SOUND CARD
.\"
By default, \fBcw\fP uses the sound device "/dev/dsp" 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 \fI-x\fP or \fI\-\-sdevice\fP can be used to specify the device
for sound card access. If the sound card device cannot be set up, \fBcw\fP
prints the error message
.IP
cannot set up soundcard sound
.PP
and exits.
.PP
Sound card devices are usually single-access devices; that is, when one
process has opened the device, other processes are prevented from using
it. If \fBcw\fP finds that the sound card is busy, it prints the error
message
.IP
open /dev/dsp: Device or resource busy
.PP
but continues to retry on each new tone until it can access the device.
Once it has control of the sound card, \fBcw\fP will only use it as long
as it has Morse code tones to sound. It will close the device during
pauses in output, to allow other programs to use it.
.PP
The main sound card device will often allow \fBcw\fP to control tone
volumes directly, but where this is not possible, \fBcw\fP uses the
mixer device instead. By default, this is "/dev/mixer", but the device
can be specified with the \fI-y\fP or \fI\-\-mdevice\fP options. In
general, as with the main sound card device, the default mixer device
is usually the correct one to use.
.PP
The mixer device is only used if the sound card does not allow volume
control through the main sound card device.
.PP
.B cw
will of course conflict with any other programs that expect exclusive
use of the system sound card (for example, MP3 players).
.PP
The sound card device is not used if \fBcw\fP is only sending tones on
the console speaker.
.PP
.\"
.\"
.\"
.SS SELECTING SUITABLE SOUND DEVICE FILES
.\"
When \fBcw\fP sounds Morse code on the UNIX console speaker, it uses
the KIOCSOUND ioctl. By default, it will try to use the device "/dev/tty1",
unless the \fI-d\fP or \fI\-\-cdevice\fP option is used. If the device
refuses to create tones, \fBcw\fP prints the error message
.IP
cannot set up console sound
.PP
and exits.
.PP
If the default device is not available, or if \fBcw\fP has no permissions
to use it, \fBcw\fP will need to be told which device to use. Which
device files are suitable will depend on which operating system is
running, and which system user ID runs \fBcw\fP. They must however be
console multiscreen devices: \fI/dev/tty1\fP and up on LINUX, \fI/dev/tty01\fP
and up on OpenServer, and \fI/dev/vt01\fP and up on UnixWare and OpenUNIX.
.PP
For console sound on LINUX, it is normally possible to run \fBcw\fP as
superuser, with the default \fI/dev/tty1\fP as the sound device; this
combination will usually work. Unless running as superuser, \fBcw\fP
won't have the necessary permission to access a 'foreign' tty.
Making \fBcw\fP an suid binary avoids this problem; the program does not
fork() or exec(), so making it suid should be relatively safe.
.PP
There is no need to worry about console sound devices if \fBcw\fP is only
sending tones on the system sound card.
.PP
.\"
.\"
.\"
.SH NOTES
.\"
Despite the fact that this manual page constantly and consistently
refers to Morse code elements as dots and dashes, DO NOT think in these
terms when trying to learn Morse code. Always think of them as 'dit's
and 'dah's.
.PP
The Morse code table in the \fBcw\fP(7,LOCAL) man page is provided for
reference only. If learning for the first time, you will be much better
off learning by hearing the characters sent, rather than by looking at
the table.
.PP
Other programs running in the system may interfere with the timing of
the Morse code that \fBcw\fP is sending. If this is a problem,
either try to run on a quiescent system, or try running \fBcw\fP
with nice(1L,C,1). UNIX is not really designed for user-level programs
to do the sort of fine timing required to send Morse code. \fBcw\fP
is therefore more sensitive than most programs to other system activity.
.PP
.B cw
uses system itimers for its internal timing. On most UNIX flavours,
itimers are not guaranteed to signal a program exactly at the specified
time, and they generally offer a resolution only as good as the normal
system 'clock tick' resolution. An itimer SIGALRM usually falls on a
system clock tick, making it accurate to no better than 10mS on a typical
100Hz kernel.
.PP
The effect of this is that an itimer period is generally either
exactly as specified, or, more likely, slightly longer. At higher
WPM settings, the cumulative effect of this affects timing accuracy,
because at higher speeds, there are fewer 10mS clock ticks in a dot
period. For example, at 12 WPM, the dot length is 100mS, enough to
contain five kernel clock ticks; at 60 WPM, the dot length is 20mS,
or just two kernel clock ticks. So at higher speeds, the effect of itimer
resolutions becomes more pronounced.
.PP
To test itimer timing, first try
.IP
X="PARIS PARIS PARIS PARIS"
.IP
echo "$X" | time cw -w 4
.PP
and note the elapsed time, which should be very close to one minute.
Next, try
.IP
echo "$X$X$X$X$X$X$X$X$X$X$X$X" | time cw -w 48
.PP
The elapsed time should be the same; if it has increased, this is the
effect of system itimers delaying for slightly longer than the specified
period (higher WPM rates make more itimer calls). That's itimers for you;
not perfect for this job, but the best there is without writing some,
and perhaps a lot of, kernel code.
.PP
OpenServer contains a \fI/usr/bin/cw\fP binary. You may need to
adjust your \fI$PATH\fP environment variable to ensure that \fBcw\fP
is on the execution path first. This issue does not occur with
UnixWare and OpenUNIX.
.PP
Except for zero, which is silent, tone values lower than 10Hz may not
sound at the expected pitch.
.PP
.\"
.\"
.\"
.SH EXAMPLES
.\"
Send a string of characters at 25 WPM, 700Hz, with no extra gaps:
.IP
echo "UNIX CW SOUNDER" | cw \-w 25 \-t 700
.PP
Send a string at varying speeds and tones on both the sound card and
the console speaker, specifying a system console device:
.IP
echo "@W12;@T400;400HZ 12WPM @W25;@T1500;1500HZ 25WPM" |
cw \-m \-sb \-d /dev/tty2
.PP
Send C-cedilla, VA, and a report of the WPM setting, with extra spacing
at half volume:
.IP
echo "[C]E [V]A @>W" | cw \-g 10 \-v 50
.PP
.\"
.\"
.\"
.SH ERRORS AND OMISSIONS
.\"
There is no way to vary the weighting of the code sent from the
standard value.
.PP
Cut numbers are not provided, though they can be emulated, up to a
point, by pre-filtering.
.PP
An output to an optional external device, for example, keying a line
on the parallel port, or a serial line, might also be useful.
.PP
.\"
.\"
.\"
.SH SEE ALSO
.\"
Man pages for \fBcw\fP(7,LOCAL), \fBcwlib\fP(3,LOCAL), \fBcwgen\fP(1,LOCAL),
\fBcwcp\fP(1,LOCAL), and \fBxcwcp\fP(1,LOCAL).
.\"
|