# txt2cw.pl

Convert a text file to audible morse code (CW). Version 1.0.4

*** For Windows Only. Linux needs some perl/audio work. ***

An application for converting a text file to morse code (WAV or MP3 file). User input determines the text to convert, speed, tone, file length, timing scheme (standard, Farnsworth, or Wordsworth), etc. There are also features for instant word recognition (IWR), and word suffixes.

From a sentence, to an entire book (Project Gutenberg is a good source), choose material of interest and complexity to your liking and practice needs.

You may specify a second text file with a list of words or suffixes to have the application send at a higher speed and/or a different tone. The intent is to develop an instant word recognition (IWR) of these patterns at the intended on-the-air speed, while still practicing instant character recognition (ICR) for the majority of the text.

The application is currently tested for windows 64 bit (others see note at end of page), and Linux. Since the source code is in PERL, your PC must have a version of the PERL language installed. In addition to PERL, one module Audio::Wav; is required, both are available free on-line (more below).

At the bottom of the page there is a display of the help page (run: txt2cw.pl -help) with some additional information about how responses to menu questions impact the application.

Note that IWR words or suffixes which precede punctuation (or are framed by quotes), as in: "word", 'word', word?, word:, etc. will only have the "word or suffix" sent at the alternate speed, not the punctuation - since the word pattern is what we want instant recognition of.

### Quick Demonstration Audio Files

These are short phrase examples.

Each sample uses some different features and options (speeds, tone, WAV/MP3) just for variety (all are up to the user).

IWR, suffix, and emphasis features display reports of matched occurrences after the input is read, but prior to creating the audio files. This is a preview of the IWR/suffixes you are interested in practicing on before listening to the code. This way you can see that you will be hearing the iwr/suffixes you are interested in practicing. Words in the IWR or suffix file that have no matches are not shown.

Find occurrences of IWR words from a list file, and send those words at an increased character speed and a different tone (tone difference is optional) than the rest of the file.

Similar to the above, this time a short alert tone introduces the IWR word (the word is the same tone as other text).

           IWR Word Report
        IWR Word         Occurrences
     ===============     ==========
     FILE                      2
     IWR                       2

     Total of (4) IWR word occurrences found in (15) words read.

Find occurrences of suffixes, from a list file and send those suffixes at an increased character speed (no tone difference).

             Suffix Report
        Suffix           Occurrences
     ===============     ==========
     ING                       3
     LY                        2
     TION                      1

     Total of (6) suffixes occurrences found in (23) words read.

## PC Environment

(many notes only apply to Windows). This is a command line application. You should create a new folder (directory) where you will run txt2cw.pl. When run, a new folder will be created with the name of the input file less the ".txt" extension. Assuming you answer "Y" to create the files or "Y" to overwrite it if it already exists, then the input file is copied there and sub folders will be created to hold the WAV or MP3 audio files.

The directories are named like: 000-127, to mean this holds up to the first 128 files (assuming the input was large, or you asked for short files to be created). This makes it easier for you to manually remove unwanted files with Windows Explorer when they are no longer of interest.

It is best to NOT have Windows Explorer or your media player sitting in the target directory, while executing the txt2cw.pl command.

## Command Line Execution

There are multiple ways to run command line applications in Windows. Below are some notes that may provide additional help for those not used to cmd line applications.

Open a command window - Press the "windows key", and type "cmd" in the search and hit ENTER.

### Does the PC have PERL?

At the prompt, type "perl -version" and ENTER. If you get any message about perl and a version number (it should be at least 5.0) you likely will will still need one optional module, called Audio::Wav (covered below). If you get 'perl' not recognized, it may not be in your PATH environment variable. Use Windows File Explorer and search for "perl.exe" (without quotes). If found, add the directory to your PATH variable (in Settings); if not get one from the internet (I'd recommend Strawberry Perl, its installation is very quick and simple). Once perl is found/installed, move on.

### Is the Audio:Wav module installed?

Simple approach is just to try the app.
Type "perl txt2cw.pl" or "perl txt2cw.pl -help". If the module is missing the error message will be clear. Use Google to find the module, instructions will depend on your perl vendor. For Strawberry Perl

1. Press the Windows Key to list the installed apps
2. Find the Strawberry Perl Folder, then press the CPAN Client entry
3. A new window opens, type: install Audio::Wav (enter)
4. StrawberryPerl is now ready.

If you didn't get an error, then you should be running txt2cw.pl.

### Do I have to always have to type "perl" ?

No. If the application works without it, you're done. If it works with perl in the command window but not without it, google "Windows XX How To Associate a File Type", a few steps will link the ".pl" file type or extension to your perl.

### Disclaimer

As with the source code which the base was inherited from, no rights are reserved. Feel free to use, share, and extend as you like to continue your morse code journey. Since source code is provided, and the code has been tested only a specific instance of Widows 10, therefore code is given "AS IS" BASIS, WITHOUT ANY WARRANTIES OR CONDITIONS OF ANY KIND, either implied or expressed, including without limitation, and any warranties of TITLE, NON-INFRINGEMENT; MERCHANTABILITY OR FITNESS FOR USE.

Thanks to KY8D - Gan Uesli Starling for making his gus_morse.pl available, which I added IWR/Suffixes/Emphasis/Wordworth, and other personal touches. Please do not complain to Gan about these features. His gus_morse.pl, does other things not mentioned here, and is Linux capable too.

Note: While tested in Windows 64, windows 32 for WAV files should be the same; windows 32 bit and MP3 is unknown. If you try windows 32 and MP3 please email me your findings at wa2nfn@gmail.com (SUBJECT txt2cw).

Download

Copyright and Disclaimer
Support QSL.NET click here.