Last Updated: February 25, 2016
· kerrick

Generate Morse code WAV files on the Linux CLI.

I've got a passing interest in amateur radio, which means I'm trying to learn cw, or Morse code. As such, I'd like to set my phone's ringtones to be various Morse code words: ".--- . -. -. .. ..-. . .-." when Jennifer calls, "... -- ..." when I get a text message, etc.

I was going to use the cw package and mess around with sox to get something recorded, but then I found that Thomas Horsten had made a nice little utility called cwwav that does it for me. It appears to be abandonware, but luckily I found and forked a copy on Github and it still works great.

To install and use cwwav:

sudo apt-get install libsndfile-dev
cd /tmp && wget --output-document cwwav.tar.gz
tar -zxvf cwwav.tar.gz && cd cwwav-master
make # If this turns out good, continue
sudo make install
echo "hello world" | cwwav -f 700 -w 20 -o hello_world.wav

Hooray for open source!