An interactive, multi-threaded console application built with Python to demonstrate text-to-telegraph translation, real-time sound synthesis, and data structures.
# Clone the repository and navigate into it
cd morse-code-translator
# (Optional) Create a virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies (Required for the Advanced Engine)
pip install playsound==1.2.2
# Run the advanced audio engine
python morse_player.py
# Run the lightweight text engine
python morse_simple.py-
morse_player.py – Advanced engine; handles multi-threaded audio playback and typewriter terminal effects.
-
morse_simple.py – Lightweight script; handles instant standard dictionary mapping and tokenizing.
-
dot.wav / dash.wav – Local audio assets utilized by the playback engine for auditory feedback.
-
MorseLab is a dual-engine Python application designed to bridge the gap between historic communication methods and modern programming concepts like concurrency.
-
Built with an emphasis on performance and clean data structures, the project demonstrates how text formatting can be translated seamlessly into temporal events (audio delays and visual animations) using real-time threading pools.
-
Multi-threaded Execution: Utilizes Python's threading library to run the auditory playback engine and the visual typewriter engine simultaneously without blocking main execution.
-
Dynamic Time-Delay Synthesis: Implements precise algorithmic pauses (time.sleep) to mimic standard international telegraph pacing for character separations (/).
-
Dual Architecture Options: Features two distinct modules—one optimized for high-fidelity interactive media (morse_player.py) and one streamlined for instant, low-overhead data output (morse_simple.py).
-
Character Tokenization: Sanitizes, normalizes, and strips user strings on the fly, accurately parsing alphanumeric data alongside specialized punctuation characters (., ,, ?, =, @).
-
Educational Focus: Designed specifically as a computer science learning resource to showcase dictionary mappings, terminal stream manipulation (sys.stdout.flush), and resource management.
- Language: Python 3.x
- Concurrency: threading (Standard Library)
- I/O Streams: sys, time, os (Standard Library)
- Audio Processing: playsound