Morse Code Projects for 2025
Well, 2024 is officially over, and honestly? I didn’t really create anything this year that I can confidently call “cool.” I barely even touched Python, which is kind of sad considering how much I used to enjoy working with it. So, for 2025, I’ve decided to dive into something fun and a little different: Morse code projects!
The Plan
I plan to start with something simple like producing Morse code. Then, maybe later in the year, I’ll move on to something more ambitious, like detecting Morse code. Honestly, I have no clue how I’ll tackle that second part yet, but that’s a problem for future me.
Producing Morse Code
My first idea was to use a simple beep sound for dots and dashes. It seemed straightforward enough… until I realized there’s no easy library for making beeps on Linux. I spent a while trying to figure it out but eventually gave up (Linux is amazing, but sometimes it loves making life complicated).
So, instead, I went with .wav
files for the sounds. I recorded a short beep for dots and a longer beep for dashes. It works fine, but I had to set up Python properly to get this running on my Linux machine. A bit annoying, but nothing I couldn’t handle.
The Code
Here’s how I approached it:
-
Morse Code Mapping
First, I needed a dictionary that maps letters and numbers to their Morse code equivalents. Pretty straightforward:morse_code = { 'A': '.-', 'B': '-...', 'C': '-.-.', ... }
-
Playing Sounds
To play the sounds, I used theplaysound
library. For each dot or dash, I play the corresponding.wav
file:def Play_morse(letter): morse = morse_code.get(letter.upper(), 'Invalid character') for i in morse: if i == "-": playsound('long.wav') elif i == ".": playsound('short.wav')
-
Timing and Spaces
Timing is super important in Morse code. I added a small pause after each letter and a longer pause after each word to make it sound natural:for word in text.split(" "): for letter in word: Play_morse(letter) time.sleep(1) time.sleep(3)
What’s Next?
For now, I’m happy with just producing Morse code—it’s simple, it works, and it feels satisfying to hear the beeps. But the real challenge will be detecting Morse code. How do I turn audio into meaningful dots and dashes? I have no idea yet, but it’s a project I’m looking forward to.
Maybe I’ll explore signal processing or dive into some Python libraries I’ve never used before. Who knows? For now, I’ll just enjoy the fact that I made my computer say “Happy New Year” in beep-beep language.