Morse Code

Morse Code with Python

Morse code is an awesome tool. I have always been amazed by it. I remember my mom and dad buying me a walkie-talkie that had the morse code on a sticker on the side. I would click on the beep button on the walkie-talkie to make the sound. It always reminded me of the starting theme of the old(1941) Superman cartoons. Although not from that era had an old VHS tape that I certainly watched more than a couple of times.

When a software engineer looks at the code it will be apparent to them that the code was not written by a person with the knowledge of computer coding. The code was actually developed by Samuel F. B. Morse in 1836 who was an artist.


Telegraph Key

Don’t get me wrong. I really like how a lot of times science gets combined with art. But I do wish it was more… binary. Yeah… That is what I was looking for.

So you may ask why  the hell is John talking about Morse code. Well the reason is that I am working on a small weekend project (one of several).

I do welcome any ideas or help with this nice little project. It will be using some DSP (Digital Signal Processing) later. Which was always my favorite subject.

The general idea is to encode text to Morse code (sound) send it via some network means to another computer which will than translate (decode) Morse sound to text.

Encode Decode Morse Code


Of course first we need to encode our text to Morse code. A small sample of the Morse code can be found below;


The small cool script below basically turns text to sound. It is important to note the rules 3, 4 and 5 in the image above which I didn’t know about before. In the code I denoted ‘*’ as the space between two letters while ‘|’ as the space between two words.

In the next part I will be using some cool Python code to record and sample the sound created by this script. And in the final part I hope to decode the Morse code.

You can find the code for this post here:

For now,

Have fun!

Python Currency Converter

Really wanted a way to handle currency and exchange rates. The thing is that a lot of the solutions were based on Python2 libraries. The one I am going to share now is based on Python 3. So please don’t bother me with questions of why this isn’t working with Python 2.

Hope this will be helpful.

Have fun!

John Roach

February 9, 2015

hate-driven development

<programming, humour>

A play on test-driven development for use when a piece of code is not necessarily broken but you hate the way it is written so much that you feel compelled to rewrite it.