Skip to main content

A Python tool to translate text to Morse code audio using various voices.

Project description

Echo-Morse

CI PyPI version License: MIT

a.k.a. 摩斯電狗 (Morse the E-Dog)

A versatile tool for converting text to Morse code (CW) with customizable audio synthesis, designed for HAM radio operators and enthusiasts.

Features

  • Convert text to/from Morse code notation
  • Generate CW audio with customizable voices and parameters
  • Support for ham radio abbreviations and prosigns (e.g. CQ, SK, AR, etc.)
  • Adjustable speed, timing, and sound characteristics

For planned enhancements and upcoming features, see our TODO list.

Installation

From PyPI (Recommended)

The easiest way to install Echo-Morse is via pip:

pip install echomorse

This will install the package and make the echomorse command available in your environment.

Make sure you have ffmpeg installed.

From Source

  1. Clone the repository:
    git clone https://github.com/baksili/echo-morse.git
    cd echo-morse
    
  2. Install with PDM: PDM is used for managing dependencies and the project environment.
    pdm install
    
    This installs the package and its dependencies. The echomorse command will then be available within the PDM environment (e.g., via pdm run echomorse ...) or globally if you activate the PDM virtual environment or install it globally.

Basic Usage

All commands are run using the echomorse entry point. If you've installed via pip, you can simply run echomorse <command>. If you've installed from source using PDM, you can run via pdm run echomorse <command>.

Convert text to Morse code notation:

echomorse text2code "CQ DX"
# Shorter alias:
echomorse t2c "CQ DX"

Convert Morse code notation to text:

echomorse code2text ".... . .-.. .-.. --- / .-- --- .-. .-.. -.."
# Shorter alias:
echomorse c2t ".... . .-.. .-.. --- / .-- --- .-. .-.. -.."

Convert text directly to Morse code audio:

echomorse text2audio "CQ CQ DE BY1QH" --output cq_call.wav
# Shorter alias:
echomorse t2a "CQ CQ DE BY1QH" -o cq_call.wav

Direct Playback:

You can pipe the audio output directly to an audio player. ffplay (from the FFmpeg project) is recommended for its robust support for stdin streaming.

echomorse t2a "SOS" -o - | ffplay -i - -nodisp -autoexit

N.B. Unlike many other commands, afplay on macOS doesn't reliably support reading from stdin. If you're using macOS, install ffplay via Homebrew (brew install ffmpeg) for this functionality.

Convert Morse code notation directly to audio:

echomorse code2audio "... --- ..." --output sos.wav
# Shorter alias:
echomorse c2a "... --- ..." -o sos.wav

Direct Playback:

Using ffplay:

echomorse c2a "TEST" -o - | ffplay -i - -nodisp -autoexit

List available voices:

echomorse voices
# Show detailed information about each voice:
echomorse voices --detailed

Piping Examples

Echo-Morse commands are designed to work with Unix-style pipes. Input arguments for text or Morse code can be piped from stdin.

# Convert text to Morse code via pipe, then to audio
echo "HELLO WORLD" | echomorse t2c | echomorse c2a -o pipe_hw.wav

# Process text from a file using cat and pipe to text2audio
cat message.txt | echomorse t2a -o message_from_file.wav --wpm 25

# Save Morse code to a file, then pipe its content to code2audio
echo "TEST" | echomorse t2c > morse_output.txt
cat morse_output.txt | echomorse c2a -o audio_from_morse_file.wav

Command Options and Help

All commands and subcommands support -h or --help for detailed usage information:

echomorse -h
echomorse text2audio -h

Common audio generation options:

# Specify a voice and speed (WPM)
echomorse t2a "SOS" --voice dog_bark --wpm 15 -o sos_dog.wav

# Control fade type and value (e.g., 10% fade)
echomorse t2a "HELLO" --fade-type percentage --fade-value 10 -o hello_fade_p.wav

# Control fade type and value (e.g., 15ms absolute fade)
echomorse t2a "WORLD" --fade-type absolute --fade-value 15 -o world_fade_abs.wav

# Set the normalization level (in dBFS)
echomorse t2a "CQ" --target-dbfs -18 -o cq_louder.wav

# Adjust pattern matching probability for voices with sequence patterns
echomorse t2a "CQ DE BY1QH" --voice dog_bark --pattern-chance 0.5 -o cq_dog_less_pattern.wav

Voice System Explained

The voice system allows for customizable audio outputs beyond simple tones. Each voice is a collection of audio files and configuration settings.

Built-in Voices

Echo-Morse comes with two built-in voices:

  • CW (built-in): Default sine wave tones for standard Morse code
  • dog_bark: Dog bark sounds for Morse code (automatically installed on first use)

To see all available voices:

echomorse voices

To install or manage voice packs:

# Install all built-in voices to your user directory
echomorse voices --install all

# Install a specific built-in voice
echomorse voices --install dog_bark

# View detailed voice information and directory locations
echomorse voices --list

Custom Voice Packs

Voices are stored in one of these locations:

  1. The OS-specific user data directory (e.g., ~/.local/share/echomorse/audio on Linux)
  2. The package's built-in audio directory (for pre-installed voices)

Each voice directory must contain:

  1. A voice_config.json configuration file
  2. Audio files (e.g., .wav) referenced in the configuration

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

echomorse-0.8.3.tar.gz (120.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

echomorse-0.8.3-py3-none-any.whl (112.8 kB view details)

Uploaded Python 3

File details

Details for the file echomorse-0.8.3.tar.gz.

File metadata

  • Download URL: echomorse-0.8.3.tar.gz
  • Upload date:
  • Size: 120.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.3 CPython/3.11.11 Darwin/24.2.0

File hashes

Hashes for echomorse-0.8.3.tar.gz
Algorithm Hash digest
SHA256 22876316cbbd2440948631a8988fe586655a12d7ab1ec170367166d557f056ce
MD5 e4d324aaf062967e71ef535f5be5cff3
BLAKE2b-256 2281eb0c077dd1f6fd800fbb6819731d1d01008fd2affcf7fe38366a6f2bb855

See more details on using hashes here.

File details

Details for the file echomorse-0.8.3-py3-none-any.whl.

File metadata

  • Download URL: echomorse-0.8.3-py3-none-any.whl
  • Upload date:
  • Size: 112.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.3 CPython/3.11.11 Darwin/24.2.0

File hashes

Hashes for echomorse-0.8.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4b3e9e6ad09a519e5d56df4cbde6021d5dc9932641a52e40b91207e61f43dcb6
MD5 b55529830c04271f9253b29a6e02740c
BLAKE2b-256 23d5c7077226743dfe1571d0934dd62c2606f5e5deb31c0b0b790237d10a5af0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page