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 list-voices
# Show detailed information about each voice:
echomorse list-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 run)

To see all available voices:

echomorse list-voices

To install or manage voice packs:

# Install all built-in voices (if they weren't auto-installed)
echomorse voice-utils install-builtin

# View voice directory locations
echomorse voice-utils dirs

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. ~/.echomorse/audio/ directory
  3. 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.2.tar.gz (247.0 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.2-py3-none-any.whl (238.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: echomorse-0.8.2.tar.gz
  • Upload date:
  • Size: 247.0 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.2.tar.gz
Algorithm Hash digest
SHA256 75d12ce5a738b842b32e2bd672038c0f5a3e254923521ba35a1f4bdfa413a57a
MD5 c4043129ad734a31a186c8496ef823e0
BLAKE2b-256 12a38686495a6811c3634553a4f5cd6bd9a37209eb410cd41b0fe21e19532867

See more details on using hashes here.

File details

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

File metadata

  • Download URL: echomorse-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 238.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 11569d243bec8224c9060cbeea8d8486d957764013d38300434ad56159513873
MD5 c9a33190a527b0e45f33350a8212544a
BLAKE2b-256 ae947e9688f590ad986fa879049d2f4226c91937b0debda31a23d26cba289de5

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