Skip to main content

Converts text to morse code signals [audio, window, keyboardleds, led, servo]

Project description

Funny Morse

Converts text to morse code signals

Examples

from funny_morse import *

print(code("Morse code")) # -- --- .-. ... .   -.-. --- -.. .

Audio

audio("play") # To play morse code audio signal for message

audio_file("code.wav", "wave file", sps=44100, freq=800) # To save

Window

window("show", wpm=5, fs=None)

Keyboard Leds

caps_lock("morse")

num_lock("on")

scroll_lock("indicator")

Pyboard

led("blink", device="/dev/ttyUSB0")

servo("tap", device="192.168.1.1")

Parallel

Parallel("try parallel",
         modes=[
            play,        # can use callables
            "window"     # can use modes
         ],
         led={
            "pin" : 2,   # kwargs to led mode
         }
         ).join()

CLI Examples

usage: funny_morse [-h] [--wpm WPM] [--fs FS] [-i] [-p] [-a FILENAME] [-w] [-c] [-n] [-s] [-l] [-m] [-P [MODES [MODES ...]]] [message [message ...]]

Convert text to morse code signals ;)

positional arguments:
  message               Text to translate or blank to take from stdin

optional arguments:
  -h, --help                                              show this help message and exit
  --wpm WPM                                               Words per minute
  --fs FS                                                 Farnsworth speed
  -i                                                      For interactive convertion
  -p, --play                                              To play audio signal
  -a FILENAME, --audio FILENAME                           To save audio signal
  -w, --window                                            To show on a window
  -c, --capsL                                             To show on caps lock indicator
  -n, --numL                                              To show on num lock indicator
  -s, --scrollL                                           To show on scroll lock indicator
  -l, --led                                               To show on LED (required Microcontroller with MicroPython)
  -m, --servo                                             To tap using servo motor (required Microcontroller with MicroPython)
  -P [MODES [MODES ...]], --parallel [MODES [MODES ...]]  For parallel modes
python -m funny_morse --wpm 15 --fs 15 -p hello
Dot width           = 80.0 ms
Dash width          = 240 ms
Character space     = 240 ms
Word space          = 560 ms
Audio :
 samples per second = 8000
 Tone period        = 1.3 ms
.... . .-.. .-.. ---

Parallel

python -m funny_morse -P p w -- now parallelly play audio and show window

Installation

Installation is available via pip:

pip install funny-morse # From PYPI

## OR ##

pip install git+https://github.com/nkpro2000sr/funny-morse.git # From github repo

Links

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

funny-morse-0.0.1.tar.gz (9.9 kB view hashes)

Uploaded Source

Built Distribution

funny_morse-0.0.1-py3-none-any.whl (11.1 kB view hashes)

Uploaded Python 3

Supported by

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