Skip to main content

Interpret wav audio files to Morse code and translate it.

Project description

Just a quick side project


inter-morse.py

This script has 2 feature, one is a decoder, the other one is an unnecessary one, noise reduction feature, that uses sox *nix utility.

Usage

usage: python -m inter_morse [-h] [-l LEVEL] {clean,decode} ... file

positional arguments:
  {clean,decode}        Commands for the decoder
    clean               Clean up the audio
    decode              Decode morse code
  file                  Input file name

optional arguments:
  -h, --help            show this help message and exit
  -l LEVEL, --level LEVEL
                        Verbosity level

Morse Audio Decoder

This feature takes in a .wav file and does the following.

  1. With pydub transforms it into an audio segment
  2. Coverts all the values that are above the max - (max * max_threshhold) to 1 and others to 0
  3. Iterated through all the binary values, when the value switches to a different one:
  • Length is calculated in milliseconds and then based on the length, the morse code symbol is determined.
DIH = 100  # On default and the same length for symbol space
DAH = DIH * 3  # The same length is assigned for letter spacing space
SPACE = DIH * 7  # The space between words
  1. Reads the codes.csv file and assigns it to a dictionary.
  2. Finally the characters separated by the Character space are compared against the dictionary and translated
  • Unknown characters are assigned ?
  • Word spaces are translated to a space and letter space is assigned to an empty string

Options

-d | --dih - The length of DIH symbol in ms (will implement a detection for this) \

  • 100ms is good enough for 15 WPM (tested for PARIS)
  • 50-60ms - 20 WPM
  • 25ms can do 50 WPM

-l | --level - The verbosity of the output, haven't done much thinking with this, but 0 is for all output.

Audio De-noiser

I thought I needed this feature, but will maybe improve it later, haven't tested it much, but all it does is

  1. Takes a .wav file
  2. Finds all 'silence' segments what are passed a given threshold ('-33 dBFS' on default)
  3. Runs sox on every segment to create a noise profile
  4. Passes the input file through all of the generated profiles
  5. Exports a cleaned version of the audio file in export directory

To Do

  • [ ] Improve the code for better detection
  • [ ] Add an encoder from text to sound
  • [ ] Add comparison option for testing
  • Add Dynamic WPM detection (so you don't have to change -d manually)

Resources

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

inter-morse-1.0.2.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

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

inter_morse-1.0.2-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file inter-morse-1.0.2.tar.gz.

File metadata

  • Download URL: inter-morse-1.0.2.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

File hashes

Hashes for inter-morse-1.0.2.tar.gz
Algorithm Hash digest
SHA256 25fb23653e107c9c3efff5efadc550f2bc29bef68eb63a95b0bb638359e312d3
MD5 35b65be64687c51b7c741809cfdcdac0
BLAKE2b-256 9b30d35e7ba9db12a06de65a99e0e5179e9606fb3719cc814eded6397a35e78c

See more details on using hashes here.

File details

Details for the file inter_morse-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: inter_morse-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 18.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.4

File hashes

Hashes for inter_morse-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0be523492a7f7aab15471854fe7f2419f784f9ed79100b4c5699218e7a8d363c
MD5 12d52ff0b568a4562f00345408e032ad
BLAKE2b-256 9fe2e81f8d98eed7f143edb95d3df75a434509a74a5966cdb38ebf0a6d62a6d8

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