1
- # [ Morse Code Translator] ( https://morsedecoder.com ) with Audio - Morsify
1
+ # [ Morse Code Translator] ( https://morsedecoder.com ) with Audio - Morse Decoder
2
2
3
- [ ![ npm-version]] [ npm ] [ ![ npm-downloads]] [ npm ] [ ![ travis-ci ]] [ travis ]
3
+ [ ![ npm-version]] [ npm ] [ ![ npm-downloads]] [ npm ]
4
4
5
- Morsify is a Morse code encoder and decoder with no dependencies. Currently, it supports Latin, Cyrillic, Greek, Hebrew, Arabic,
5
+ Morse code encoder and decoder with no dependencies. It supports Latin, Cyrillic, Greek, Hebrew, Arabic,
6
6
Persian, Japanese, Korean, and Thai, with audio-generation functionality using the [ Web Audio API] ( https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API ) .
7
7
8
8
## Installation
9
9
10
10
### npm
11
11
12
12
``` bash
13
- $ npm install morsify --save
13
+ $ npm install morse-decoder --save
14
14
```
15
15
16
16
### yarn
17
17
18
18
``` bash
19
- $ yarn add morsify
19
+ $ yarn add morse-decoder
20
20
```
21
21
22
22
## Usage
23
23
24
24
``` js
25
- const morsify = require (' morsify ' );
26
- const encoded = morsify .encode (' SOS' ); // ... --- ...
27
- const decoded = morsify .decode (' ... --- ...' ); // SOS
28
- const characters = morsify .characters (); // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}
29
- const audio = morsify .audio (' SOS' );
25
+ const morse = require (' morse-decoder ' );
26
+ const encoded = morse .encode (' SOS' ); // ... --- ...
27
+ const decoded = morse .decode (' ... --- ...' ); // SOS
28
+ const characters = morse .characters (); // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}
29
+ const audio = morse .audio (' SOS' );
30
30
audio .play (); // play audio
31
31
audio .stop (); // stop audio
32
32
audio .exportWave (); // download audio wave file (promise)
33
33
const url = await audio .getWaveUrl (); // get audio wave url (promise)
34
34
const blob = await audio .getWaveBlob (); // get audio wave blob (promise)
35
35
```
36
36
37
- Alternatively, you can use the library directly with including the source file.
38
-
39
- ``` html
40
- <script src =" https://rawgit.com/ozdemirburak/morsify/master/dist/morsify.min.js" ></script >
41
- <script >
42
- var encoded = morsify .encode (' SOS' ); // ... --- ...
43
- var decoded = morsify .decode (' ... --- ...' ); // SOS
44
- var characters = morsify .characters (); // {'1': {'A': '.-', ...}, ..., '11': {'ㄱ': '.-..', ...}}
45
- var audio = morsify .audio (' SOS' );
46
- var oscillator = audio .oscillator ; // OscillatorNode
47
- var context = audio .context ; // AudioContext
48
- var gainNode = audio .gainNode ; // GainNode
49
- audio .play (); // play audio
50
- audio .stop (); // stop audio
51
- audio .exportWave (); // download audio wave file (promise)
52
- var url = await audio .getWaveUrl (); // get audio wave url (promise)
53
- var blob = await audio .getWaveBlob (); // get audio wave blob (promise)
54
- </script >
55
- ```
56
-
57
- ## Options and Localization
37
+ ### Options and localization
58
38
59
39
You can customize the dash, dot, or space characters and specify the alphabet with the priority option for
60
40
an accurate encoding and decoding.
@@ -77,12 +57,12 @@ Set the priority option according to the list below.
77
57
- 12 => Thai
78
58
79
59
``` js
80
- const cyrillic = morsify .encode (' Ленинград' , { priority: 5 }); // .-.. . -. .. -. --. .-. .- -..
81
- const greek = morsify .decode (' ... .- --. .- .--. .--' , { priority: 6 }); // ΣΑΓΑΠΩ
82
- const hebrew = morsify .decode (' .. ––– . –––' , { dash: ' –' , dot: ' .' , priority: 7 }); // יהוה
83
- const japanese = morsify .encode (' NEWS' , { priority: 10 , dash: ' -' , dot: ' ・' , separator: ' ' }); // -・ ・ ・-- ・・・
84
- const characters = morsify .characters ({ dash: ' –' , dot: ' •' }); // {'1': {'A': '•–', ...}, ..., '11': {'ㄱ': '•–••', ...}}
85
- const arabicAudio = morsify .audio (' البراق' , { // generates the Morse .- .-.. -... .-. .- --.- then generates the audio from it
60
+ const cyrillic = morse .encode (' Ленинград' , { priority: 5 }); // .-.. . -. .. -. --. .-. .- -..
61
+ const greek = morse .decode (' ... .- --. .- .--. .--' , { priority: 6 }); // ΣΑΓΑΠΩ
62
+ const hebrew = morse .decode (' .. ––– . –––' , { dash: ' –' , dot: ' .' , priority: 7 }); // יהוה
63
+ const japanese = morse .encode (' NEWS' , { priority: 10 , dash: ' -' , dot: ' ・' , separator: ' ' }); // -・ ・ ・-- ・・・
64
+ const characters = morse .characters ({ dash: ' –' , dot: ' •' }); // {'1': {'A': '•–', ...}, ..., '11': {'ㄱ': '•–••', ...}}
65
+ const arabicAudio = morse .audio (' البراق' , { // generates the Morse .- .-.. -... .-. .- --.- then generates the audio from it
86
66
unit: 0.1 , // period of one unit, in seconds, 1.2 / c where c is speed of transmission, in words per minute
87
67
fwUnit: 0.1 , // period of one Farnsworth unit to control intercharacter and interword gaps
88
68
oscillator: {
@@ -117,9 +97,7 @@ $ gulp
117
97
## License
118
98
The MIT License (MIT). Please see [ License File] ( LICENSE ) for more information.
119
99
120
- [ npm-version ] : https://img.shields.io/npm/v/morsify.svg?style=flat-square
121
- [ npm-downloads ] : https://img.shields.io/npm/dm/morsify.svg?style=flat-square
122
- [ travis-ci ] : https://img.shields.io/travis/ozdemirburak/morsify/master.svg?style=flat-square
100
+ [ npm-version ] : https://img.shields.io/npm/v/morse-decoder.svg?style=flat-square
101
+ [ npm-downloads ] : https://img.shields.io/npm/dm/morse-decoder.svg?style=flat-square
123
102
124
- [ npm ] : https://www.npmjs.com/package/morsify
125
- [ travis ] : https://travis-ci.org/ozdemirburak/morsify
103
+ [ npm ] : https://www.npmjs.com/package/morse-decoder
0 commit comments