The song YYZ by Rush opens with a theme based on the rhythm of “YYZ” in Morse code:

-.-- -.-- --..

YYZ is the designation for the Toronto Pearson International Airport, the main airport serving Toronto. The idea for the song came from hearing the airport identifier in Morse code.

However, the song puts no spaces between rhythm corresponding to each letter. Here’s what the opening riff would look like in sheet music:

Each dash is a middle C and each dot is an F# a tritone below middle C.

When I listen to the song, I don’t hear YYZ. My mind splits up the rhythm with each sequence of long notes starting a group:

-. ---. ----..

So I hear the 20/8 time signature as (3 + 7 + 10)/8.

In terms of Morse code, -. is N. Interpreting the other groupings depends on what you mean by Morse code. The American amateur radio community defines Morse code as 40 characters: the 26 letters of the Latin alphabet, 10 digits, and 4 more symbols: / = , . Using that definition of Morse code, there are no symbols corresponding to `---.`

or `----..`

. There is no symbol corresponding to `----`

either. More on unused sequences here.

However, sometimes `---.`

is used for Ö and `----`

for Š. So the way I hear “YYX” would be more like “NÖŠI”.

There are many other ways to parse `-.---.----..`

into Morse code symbols. For example, NO1I

-. --- .---- ..

## Enumeration

How many ways could you split `-.---.----..`

into valid Morse code?

Here’s an outline of a recursive algorithm to enumerate the possibilities.

Start at the beginning and list the possible symbols formed by consecutive dots and dashes. In our case the possible symbols are T, N, K, and Y. So the possibilities are

- T (
`-`

) added to the front of all sequences that start with`.---.----..`

- N (
`-.`

) added to the front of all sequences that start with`---.----..`

- K (
`-.-`

) added to the front of all sequences that start with`--.----..`

- Y (
`-.--`

) added to the front of all sequences that start with`-.----..`

So for the first bullet point, for example, how would we find all sequences that start with `.---.----..`

? Use the same idea.

- E (
`.`

) added to the front of all sequences that start with`---.----..`

- A (
`.-`

) added to the front of all sequences that start with`--.----..`

- W (
`.--`

) added to the front of all sequences that start with`-.----..`

- J (
`.---`

) added to the front of all sequences that start with`.----..`

So pull off all the symbols you can from the beginning of the list of dots and dashes and in each case recurse on the rest of the list.

The number of ways is 1435, found by this Prolog program:

A younger me, while bored at school, discovered that Blues is the Devil’s music. “`-… .-.. ..- . … → -…. -…. -….“`

A slightly older me can throw one-liners at “`/usr/share/dict/words“` and discover more morsenyms like streaming = strutting, muskets = gaskets, midday = gravy, Finland = inflated, or Einstein = stiff.

The tedious part of implementing this is just copying all the character mappings. Here’s a gist for that (in Python syntax): https://gist.github.com/rvcx/3037546aad1de45cea55080a479f3d2f

My five-minute, ten-line implementation finds 1435 different interpretations of the un-spaced Morse that can be read “yyz”.

Ha ha.

I grew up in Toronto and am old enough to remember the song when it first came out. I had no idea the rhythm was related to morse code.

Cheers and thanks for all the great posts.

From @iconjack on Twitter:

Here you go. The variable

codesis the Morse code mapping, as given by @rvcx’s tweet.e = lambda s: [codes[l] + t for l in codes if s.startswith(l) for t in e(s[len(l):])] if s else [”]