Morse Code Translator with Audio - Morsify
Morsify is a Morse code encoder and decoder with no dependencies. Currently, it supports Latin, Cyrillic, Greek, Hebrew, Arabic, Persian, Japanese, Korean, and Thai, with audio-generation functionality using the Web Audio API.
Installation
npm
$ npm install morsify --save
yarn
$ yarn add morsify
Usage
const morsify = ;const encoded = morsify; // ... --- ...const decoded = morsify; // SOSconst characters = morsify; // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}const audio = morsify;audio; // play audioaudio; // stop audio
Alternatively, you can use the library directly with including the source file.
Options and Localization
You can customize the dash, dot, or space characters and specify the alphabet with the priority option for an accurate encoding and decoding.
The priority option gives direction to the plugin to start searching for the given character set first.
Set the priority option according to the list below.
- 1 => ASCII (Default)
- 2 => Numbers
- 3 => Punctuation
- 4 => Latin Extended (Turkish, Polish etc.)
- 5 => Cyrillic
- 6 => Greek
- 7 => Hebrew
- 8 => Arabic
- 9 => Persian
- 10 => Japanese
- 11 => Korean
- 12 => Thai
const cyrillic = morsify; // .-.. . -. .. -. --. .-. .- -..const greek = morsify; // ΣΑΓΑΠΩconst hebrew = morsify; // יהוהconst japanese = morsify; // -・ ・ ・-- ・・・const characters = morsify; // {'1': {'A': '•–', ...}, ..., '11': {'ㄱ': '•–••', ...}}const arabicAudio = morsify;const oscillator = arabicAudiooscillator; // OscillatorNodeconst context = arabicAudiocontext; // AudioContext;const gainNode = arabicAudiogainNode; // GainNodearabicAudio; // will start playing Morse audioarabicAudio; // will stop playing Morse audio
Contributing and Known Issues
Contributions are welcome.
Generating Minified Files
Install node and npm and run the commands below.
$ npm install --global gulp-cli$ npm install$ gulp
License
The MIT License (MIT). Please see License File for more information.