Skip to main content
                                                      _ 
                                                     | |
 _ __   _   _  _ __ ___    ___   _ __  ___   ___   __| |
| '_ \ | | | || '_ ` _ \  / _ \ | '__|/ __| / _ \ / _` |
| |_) || |_| || | | | | || (_) || |   \__ \|  __/| (_| |
| .__/  \__, ||_| |_| |_| \___/ |_|   |___/ \___| \__,_|
| |      __/ |                                          
|_|     |___/

A Python library for Morse code processing, supporting text encoding/decoding, multi-language mappings, audio signal generation and decoding, and waveform visualization.

PyPI • Documentation

PyPI Downloads


Features

  • Convert text to Morse code
  • Convert Morse code to text
  • Multi-language support
    • English
    • Russian
    • Hindi
  • Generate Morse code audio signals
  • Decode Morse code from WAV audio files
  • Visualize Morse code waveforms
  • JSON-based language mappings
  • Command-Line Interface (CLI)
  • Fully tested with automated CI pipeline

Quick Start

Get started with the most commonly used features:


Installation

pip install pymorsed

Quick Start Examples

Encode Text

Convert text into Morse code:

from pymorsed import encode

morse = encode("HELLO WORLD")

print(morse)

Output:

.... . .-.. .-.. --- / .-- --- .-. .-.. -..

Decode Morse Code

Convert Morse code into text:

from pymorsed import decode

text = decode(".... . .-.. .-.. --- / .-- --- .-. .-.. -..")

print(text)

Output:

HELLO WORLD

Generate Morse Audio

Generate and play a Morse code audio signal:

from pymorsed import encode
from pymorsed.audio_encoder import morse_to_audio, play_audio

morse = encode("SOS")
audio = morse_to_audio(morse)

play_audio(audio)

Save Audio to File

Save a generated Morse code audio signal:

from pymorsed.audio_encoder import morse_to_audio, save_audio

audio = morse_to_audio("... --- ...")

save_audio(
    audio,
    "sos.wav",
    44100
)

Decode Audio File

Decode Morse code from a WAV audio file:

from pymorsed.audio_decoder import decode_from_file

text = decode_from_file("sos.wav")

print(text)

Output:

SOS

Command-Line Interface (CLI)

pymorsed also provides a command-line interface for performing common Morse code and audio operations directly from the terminal.

Available Commands

pymorsed
├── encode
├── decode
├── encode-audio
├── decode-audio
└── version

CLI Examples

Encode text into Morse code:

pymorsed encode "HELLO WORLD"

Decode Morse code into text:

pymorsed decode ".... . .-.. .-.. ---"

Generate and play Morse code audio:

pymorsed encode-audio "SOS"

Save generated audio to a file:

pymorsed encode-audio "SOS" -o sos

The output filename extension is optional. If no extension is provided, .wav is used by default.

Decode a Morse code audio file:

pymorsed decode-audio "E://audios/sos.wav"

Display the available commands:

pymorsed --help

Display the installed version:

pymorsed --version

or:

pymorsed version

For the complete CLI reference, see the pymorsed CLI Documentation.


Morse Code Conventions

pymorsed follows standard Morse code formatting:

Symbol Meaning
. Dot
- Dash
Space ( ) Letter separator
/ Word separator

Example:

HELLO WORLD

becomes:

.... . .-.. .-.. --- / .-- --- .-. .-.. -..

Supported Languages

Language Code
English english
Russian russian
Hindi hindi

Additional language mappings may be added in future releases.


Example Imports

Root Package Imports

from pymorsed import encode
from pymorsed import decode

Module Imports

from pymorsed.encoder import encode
from pymorsed.decoder import decode

from pymorsed.audio_encoder import (
    morse_to_audio,
    play_audio,
    save_audio,
    plot_waveform
)

from pymorsed.audio_decoder import decode_from_file

Development

Clone the repository:

git clone https://github.com/ShauryaPrakashVerma/pymorsed.git
cd pymorsed

Install dependencies:

pip install -e .

Run tests:

pytest

Run tests with coverage:

pytest --cov=pymorsed

License

This project is licensed under the MIT License.

See the LICENSE file for details.

Metadata

Release files for pymorsed 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymorsed 0.2.0
File Size Uploaded
pymorsed-0.2.0.tar.gz 13.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymorsed 0.2.0
File Interpreter ABI Platform
pymorsed-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 24.7 kB

Release files / pymorsed-0.2.0.tar.gz

Download URL pymorsed-0.2.0.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b406098c1e8a9607ba089d121e8012d6bcd658793409fe886a341d0828689edc
BLAKE2b-256 checksum
How to use checksums
7cda2b1e030ce2eff0af7a61075810cc638140223d57b9cc1463861766177e31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / pymorsed-0.2.0-py3-none-any.whl

Download URL pymorsed-0.2.0-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
360c56a339241964d5a4c39a593317e617b7d4d059c90785352ad9eb15876bf6
BLAKE2b-256 checksum
How to use checksums
c9f6a7a7953ec3a2667a719077387ed9e49e3f1b799f2ee009d487484ebbcfc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page