Skip to main content

Encode, decode, generate, and analyze Morse code audio signals in Python.

Project description

pymorsed

A Python library for encoding, decoding, generating, and analyzing Morse code audio signals.

Features

  • Convert text to Morse code

  • Convert Morse code to text

  • Multi-language support

    • English
    • Russian
  • Generate Morse code audio signals

  • Decode Morse code from WAV audio files

  • Visualize Morse code waveforms

  • JSON-based language mappings

  • Fully tested with automated CI pipeline


Documentation

Full documentation is available at : https://shauryaprakashverma.github.io/pymorsed/


Installation

pip install pymorsed

Quick Start

Encode Text

from pymorsed import encode

morse = encode("HELLO WORLD")
print(morse)

Output:

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

Decode Morse Code

from pymorsed import decode

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

Output:

HELLO WORLD

Generate Morse Audio

from pymorsed import encode
from pymorsed.audio_encoder import morse_to_audio

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

Save Audio to File

from pymorsed.audio_encoder import (
    morse_to_audio,
    save_audio
)

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

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

Decode Audio File

from pymorsed.audio_decoder import decode_from_file

text = decode_from_file("sos.wav")

print(text)

Output:

SOS

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

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.


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

pymorsed-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

pymorsed-0.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file pymorsed-0.1.0.tar.gz.

File metadata

  • Download URL: pymorsed-0.1.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for pymorsed-0.1.0.tar.gz
Algorithm Hash digest
SHA256 06609bb6b13bfcc1f3a74aa7342479d0efb29f6078f1bbb9b207aca8bf586e0b
MD5 50c3ec5193b31a3028d97b08c1ab1be9
BLAKE2b-256 65e4ecfb1400e553ed19efaef9e36e565e72bda620ccd4d3d33caac9cf24614c

See more details on using hashes here.

File details

Details for the file pymorsed-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pymorsed-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for pymorsed-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ada1ae6eb44598eda9e38af9d7cdbd2b63198e4647d8e190d04d2dc0d5e27a3
MD5 2e2a7713d666692c748b205705fad60b
BLAKE2b-256 9238cd9d82ab13c5393e629f68a4a37451cc8cbc08d90a9c74f02c91e84712c8

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