Python script to convert WAV audio files containing Morse code into readable text.
translate-morse.py tool can:
- Analyze WAV audio files containing Morse code sounds
- Detect short (dot) and long (dash) beeps
- Convert Morse code to plain text
- Support letters A-Z and numbers 0-9
Make sure you have installed the following library:
pip install pydub- Python 3.x
- WAV format audio files
pydublibrary for audio processing
Ensure you have a WAV audio file containing Morse code. The file should:
- Format: WAV only (other formats not supported)
- Content: Clear beeps of different durations (short for dots, long for dashes)
- Quality: Good audio quality with distinct pauses between letters and words
- Channel: Will be automatically converted to mono during processing
The script uses interactive input for file selection. Simply run:
python translate-morse.pyYou'll see the ASCII art header and then be prompted:
Masukkan path file audio Morse (.wav):
Enter the path to your WAV file. Examples:
morse.wav(file in current directory)/home/user/audio/morse.wav(absolute path)../audio/morse.wav(relative path)
The script will display:
- Kode Morse: Raw morse code with dots (.) and dashes (-)
- Hasil Decode: Final translated text in uppercase
The script will produce two outputs:
- Morse Code: Representation of dot (.) and dash (-) symbols
- Decoded Result: Translated text
# Run with morse.wav file
python translate-morse.pyExample Output:
Morse Code: .... . .-.. .-.. --- .-- --- .-. .-.. -..
Decoded Result: HELLO WORLD
The script uses the following adjustable parameters:
min_silence_len=50: Minimum silence duration for detection (ms)silence_thresh=-40: Threshold to detect silence (dB)- Beep duration:
< 100ms: Dot (.)>= 100ms: Dash (-)
- Pause duration:
150-300ms: Pause between letters>= 300ms: Pause between words
pip install pydub- Ensure WAV file quality is good
- Adjust
silence_thresh(higher value for noisy audio) - Adjust
min_silence_lenif pauses are too short or long
- Check audio file quality
- Adjust duration thresholds for dot/dash
- Ensure proper pauses between letters and words
A: .- B: -... C: -.-. D: -..
E: . F: ..-. G: --. H: ....
I: .. J: .--- K: -.- L: .-..
M: -- N: -. O: --- P: .--.
Q: --.- R: .-. S: ... T: -
U: ..- V: ...- W: .-- X: -..-
Y: -.-- Z: --..
0: ----- 1: .---- 2: ..--- 3: ...-- 4: ....-
5: ..... 6: -.... 7: --... 8: ---.. 9: ----.
To contribute or report bugs:
- Fork this repository
- Create a branch for a new feature
- Commit your changes
- Push to the branch
- Create a Pull Request
This script is intended for educational and IDN CTF (Capture The Flag) purposes.