Script: Text-to-NATO-spelling

Straight Key In my morse training adventure on lcwo.net, I hit a slight bump in the road. At Koch lesson 33 (of 40 lessons total), I can't seem to copy with 90% accuracy, which is the criterea for moving to the next lesson. See my downward trend here. It is partly because of gradually speeding up the Farnsworth timing from 10wpm to 12wpm so I can be on 20wpm at lesson 40. It is also because of shorter, less focussed daily training sessions, I must confess.

LCWO.net progress

I experimented a bit, and it seems I can recognize characters easily at 37wpm, but I can't form the words and recognize letters at the same time. More accurately: I can't seem to be able to remember 3 to 5 characters, form a word and listen to new characters at the same time.

To see if this was morse or memory related, I wrote a small program which spells out a text in speech, [NATO phonetic alphabet style](https://en.wikipedia.org/wiki/NATO_phonetic_alphabet). I converted some text with it, and proved that my analysis of my own morse problem was correct. This script can also be used to train "word building", so that's why I thought I'd share it with you.

As for me, I am going to switch to morse word training on lcwo.net for a while, see if that helps. Here is the code for spelling out a text using Apple's built-in text-to-speech synthesizer. It takes a single argument as text file:

[sourcecode language="bash" wraplines="true" gutter="false"] #!/bin/bash

The input text file to parse (first argument)

inputfile="${1}"

(Temporary) files to write

outputfile="${1}.m4a" lowercase="${1}.lowercase.txt" tempfile="${1}.spelled.txt"

clean up in case we crashed last time

rm ${tempfile} rm ${lowercase} rm ${outputfile}

everything to lower case

tr '[:upper:]' '[:lower:]' < "${inputfile}" > "${lowercase}"

spell all the letters (change or add as needed)

spell="" while IFS= read -n1 char; do case "${char}" in "a") spell="${spell}, alpha" ;; "b") spell="${spell}, bravo" ;; "c") spell="${spell}, Charley" ;; "d") spell="${spell}, delta" ;; "e") spell="${spell}, echo" ;; "f") spell="${spell}, foxtrot" ;; "g") spell="${spell}, golf" ;; "h") spell="${spell}, hotel" ;; "i") spell="${spell}, India" ;; "j") spell="${spell}, Juliet" ;; "k") spell="${spell}, kilo" ;; "l") spell="${spell}, leehma" ;; "m") spell="${spell}, Mike" ;; "n") spell="${spell}, November" ;; "o") spell="${spell}, Oscar" ;; "p") spell="${spell}, papa" ;; "q") spell="${spell}, Quebec" ;; "r") spell="${spell}, Romeo" ;; "s") spell="${spell}, Sierra" ;; "t") spell="${spell}, tango" ;; "u") spell="${spell}, uniform" ;; "v") spell="${spell}, Victor" ;; "w") spell="${spell}, whiskey" ;; "x") spell="${spell}, X-ray" ;; "y") spell="${spell}, Yankee" ;; "z") spell="${spell}, Zulu" ;; "0") spell="${spell}, zero" ;; "1") spell="${spell}, one" ;; "2") spell="${spell}, two" ;; "3") spell="${spell}, three" ;; "4") spell="${spell}, four" ;; "5") spell="${spell}, five" ;; "6") spell="${spell}, six" ;; "7") spell="${spell}, seven" ;; "8") spell="${spell}, eight" ;; "9") spell="${spell}, nine" ;; ".") spell="${spell}. period" ;; ",") spell="${spell}. comma" ;; "=") spell="${spell}, equals" ;; "/") spell="${spell}, slash" ;; "?") spell="${spell}. questionmark" ;; *) if [ -n "$spell" ]; then echo "${spell:2}." >> "${tempfile}"; spell=""; fi ;; esac done < "${lowercase}"

Take the tempfile, convert it to spoken text.

say -r 250 -v Alex -f ${tempfile} -o ${outputfile}

Files left for further processing if you like.

ls -l ${inputfile}* [/sourcecode]