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 *

         
@rolfje.com
www.youtube.com/watch?v=ycGh...
16 hours ago
@rolfje.com
Vandaag gaat #degrootstekerstboom aan! www.degrootstekerstboom.nl
19 hours ago
Reposted by @rolfje.com
@shadowmakersdr.bsky.social
Ik ben blij dat de overheid zo consequent is in z'n campagnes. Iedereen fulltime werken, maar wel buiten de spits naar je werk en gebruik de stroom van je zonnepanelen overdag (als je niet thuis bent want op je werk) terwijl je mantelzorgt èn fsyieke winkels bezoekt om 'de winkelstraat' te redden.
3 days ago

Recent Comments

  • Monica Hall on Het belastinghuiswerk nagekeken
  • rolfje on Spring SystemPropertyInitializingBean
  • plinko idle clicker on Spring SystemPropertyInitializingBean
  • rolfje on The podcast problem (fixed)
  • SirenMix on The podcast problem (fixed)

Tags

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

Categories

  • Apple (107)
  • Divorce (1)
  • Electronics (5)
  • Fun (58)
  • Games (8)
  • Hardware (74)
  • Microsoft (18)
  • Racing (16)
  • Software (144)
  • Uncategorized (69)
  • Workshop (23)

Archives

Brought to you without adds, banners, cookies or tracking. This one is on me. Yes, life can be this good. Pay it forward.
AI policy - Privacy policy

Copyright © 2026 www.rolfje.com.

Powered by PressBook WordPress theme