Skip to content

www.rolfje.com

Script: Text-to-NATO-spelling

Posted on 2013-05-27 By rolfje No Comments on Script: Text-to-NATO-spelling

Straight KeyIn 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. 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:

#!/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}*
Fun Tags:Apple, cw, morse, Utilities

Post navigation

Previous Post: BaseCamp Import problem [fixed]
Next Post: How big is 5 Zettabyte?

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

           

Recent Comments

  • rolfje on Methode Buijs uitgelegd
  • LinkedIn is at Peak Enshittifaction – Will Chatham's Blog on Linked-In not really Opt-in?
  • Hans j on 1N4148 diode as RF switch
  • Roaming Rhonda on DLNA on OSX, done right
  • Frans on How to fix a Krups XN2001 Nespresso machine

Tags

Anonimatron Apple backup design DIY DRM eclipse environment Fun gmail google hacking hamradio Hardware helicopter iphone ipod iTunes Java Keynote maven modelling motorcycle music news opinion oracle osx photo photography programming repair review security Software Steve Jobs T-Mobile technology Time Machine Ubuntu usability Utilities vacation windows Workshop

Categories

  • Apple (105)
  • Divorce (1)
  • Electronics (3)
  • Fun (57)
  • Games (7)
  • Hardware (72)
  • Microsoft (18)
  • Racing (14)
  • Software (134)
  • Uncategorized (65)
  • Workshop (20)

Archives

Copyright © 2025 www.rolfje.com.

Powered by PressBook WordPress theme