Skip to content

sansirit/morse_code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Morse Code Audio Player

A real-time morse code audio player that converts your keyboard input into morse code beeps. Type any letter, number, or space and hear it immediately played back as morse code audio signals.

Features

  • Real-time conversion: Converts letters A-Z, numbers 0-9, and spaces to morse code
  • Audio playback: Plays morse code using system beeps (750 Hz frequency)
  • Proper timing: Follows international morse code timing standards
  • Threaded processing: Non-blocking keyboard input with queued audio processing
  • Cross-platform: Works on Windows (uses winsound for audio)

Requirements

  • Python 3.6+
  • Windows OS (for winsound module)
  • Required packages (see requirements.txt):
    • pynput - For keyboard input detection

Installation

  1. Clone or download this project
  2. Install the required dependencies:
    pip install -r requirements.txt

Usage

  1. Run the program:

    python morse_code.py
  2. Start typing on your keyboard:

    • Letters A-Z: Converted to morse code and played immediately
    • Numbers 0-9: Converted to morse code and played immediately
    • Space: Plays a longer pause (word separation)
    • ESC: Exit the program
  3. The console will display each character and its corresponding morse code pattern as you type.

Example

Type something (ESC to quit)...
H: ....
E: .
L: .-..
L: .-..
O: ---
 :  
W: .--
O: ---
R: .-.
L: .-..
D: -..

Morse Code Reference

Letters

  • 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: --..

Numbers

  • 1: .---- 2: ..--- 3: ...-- 4: ....- 5: .....
  • 6: -.... 7: --... 8: ---.. 9: ----. 0: -----

Technical Details

Timing Standards

The program follows international morse code timing standards:

  • Dot duration: 100ms (1 unit)
  • Dash duration: 300ms (3 units)
  • Intra-character space: 100ms (1 unit) - gap between dots/dashes within a character
  • Inter-character space: 300ms (3 units) - gap between characters
  • Word space: 700ms (7 units) - gap between words

Architecture

  • Main thread: Handles keyboard input detection using pynput
  • Worker thread: Processes morse code conversion and audio playback
  • Queue system: Buffers keystrokes for smooth audio playback without blocking input

Audio System

  • Uses Windows winsound.Beep() function
  • Fixed frequency of 750 Hz for all morse code signals
  • Variable duration based on dot/dash timing

Limitations

  • Windows only: Uses winsound module which is Windows-specific
  • English characters only: Supports A-Z, 0-9, and space
  • No punctuation: Special characters and punctuation are not supported
  • System audio: Relies on system's ability to produce beep sounds

Customization

You can modify the following constants in morse_code.py to customize the behavior:

UNIT_DURATION = 100        # Base timing unit in milliseconds
# Adjust this to make morse code faster (lower) or slower (higher)

The audio frequency can be changed by modifying the 750 value in the winsound.Beep(750, duration) calls.

Contributing

Feel free to submit issues, feature requests, or pull requests. Some potential improvements:

  • Add support for punctuation marks
  • Cross-platform audio support (Linux/macOS)
  • Adjustable speed settings
  • Visual morse code display
  • Save/load morse code messages

License

This project is open source and available under the MIT License.

About

πŸ”Š Real-time morse code audio player for Windows. Type letters, numbers, or spaces and instantly hear them as morse code beeps. Features proper timing standards, threaded processing, and 750Hz audio output. Perfect for learning morse code! πŸ”€βž‘οΈπŸ“»

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages