Tag Archives: Morse

morse-1 code

Cron Driven Morse Code Time Sounder

My goal was to make a new hourly chime,something with a bit of intelligence to it than just the same tone every hour. It was actually one of those random things that runs through your head when laying in bed trying to get in a mood to sleep.

A bit of history

Typically I have been using a preexisting system sound on a Linux PC to annunciate that it is the top of the hour. This helps to keep track of how long I am on the computer, time to take a break maybe. It also makes me away of the time, in case I am in the zone with coding or whatnot and need to be aware of how time flies. Once you have this, you kind of look for it, even when you are in the room doing something other than computer work.

Up to now this is what I typically had in my crontab…

00 09-23 * * * aplay /usr/share/sounds/fLight__2.0/stereo/Message.wav

I restrict the hours down, just so the thing doesn’t wake me at night if I forget to turn off the PC.

Festival

Years ago I used Festival, the text to speech program and made it annunciate the time. This works OK as long as you are at the PC. If you are away from it a bit, you don’t always pick up what the machine generated voice is saying. Morse Code has an advantage over voice, in that the tones are easy to pick up, even when faint. I have a ham license and have experienced this first hand. So that was my line of thinking with using Morse to give me the time at the top of the hour. It would be easy to not only know that it is the top of the hour but, I can tell what hour it is easily with Morse code. Plus it seemed like a fun twist. I have even thought of putting something like this on my Pi which runs 24/7 in my office. In our living room we have a bird clock, that has different bird sounds for each hour and that has been pretty useful at times, so that got me going on this whole hourly chime adventure years ago.

I was initially inclined to make my own tones but, a brief search found Stephen C. Phillips site and his Morse Code Translator. Using it I was able to create a more code “hour” sound file from 0-23, that plays the correct sounding for every hour.

It is possible to take any sound files and label them 0-23.wav and get other types of sounds to chime at the top of the hour. Birds songs, train whistles, nature sounds, the possibilities are endless.

How it works

Using the Morse Code Translator, I was able to create a series of Morse Code translations from 0-23, in WAV file format. The WAV files get put in a directory, morse-code-audio under my home folder and the following script gets called in place of the line shown above in my crontab….

#!/bin/bash

sounddir=/home/erick/morse-code-audio

# Grab the Hours off of the date.

hour=$(date +"%H")

#Call the correct file based off of the hour
 aplay $sounddir/$hour.wav

WAV Files for the Morse Code Time Sounder

I put the 0-23.wav files online, as a tar.gz.

morse-code-audio.tar

Compression, Signal Processing, Information Theory and Cryptography

Uncompressed the 24 WAV files in the tar file are a total of 348K , it is interesting just how compressible single frequency tones are. All of them compress down to a 2.8K tar.gz. I had to check twice, I thought I was missing a bunch of files. But it stands to reason when one thinks of a single frequency turned on and off slowly, has very little bandwidth. Provided the keying is shaped in a way so that it is not a pure sine wave modulated by a square wave, the pulses have to be shaped the corners rounded off to get the bandwidth below 100Hz. Thinking of Fourier transform, a tone left on from infinity has a bandwidth of zero. A digital signal, pulse shaped, on and off keying at 20WPM code is going to have a real narrow bandwidth, therefore highly compressible. The opposite extreme, white noise, would not be compressed down at all by gzip or any of the fancier types of compression. White noise is random, equally distributed across the spectrum, hence incompressible. But it makes for a hell of an encryption key for that very reason. The worlds of signal processing and cryptography do come together in interesting ways!

Resources

Stephen C Phillips has an excellent website and blog that covers a lot of technical topics among with the Morse Code Translator is an example. He also covers Python code and the Raspberry Pi for example.

http://blog.scphillips.com/

The featured image is from this site and it is an interesting read…

https://www.raspberrypi.org/learning/morse-code-virtual-radio/worksheet/