The most complete Morse code library for JavaScript and TypeScript — built for professional radio operators, educators, and developers. Features 11 character sets, prosigns, PARIS/Farnsworth timing, real-time audio synthesis via Web Audio API, and WAV export. Zero dependencies, tree-shakeable, TypeScript-first.
Built and used in production by MorseCodeApp.com — a morse code translator and learning platform used by thousands every month. This is the same library that powers the website.
Install · Quick Start · Audio · API Reference · Report Bug
| @morsecodeapp/morse | morse-code-translator | morsify | |
|---|---|---|---|
| Character sets | 11 | 12 | 1 |
| Audio playback (Web Audio) | Yes | — | Partial |
| WAV export | Yes | — | — |
| Sound presets | 6 | — | — |
| Gain envelope (click-free) | Yes | — | — |
| Prosigns (SOS, AR, SK…) | 10 | — | — |
| Farnsworth timing | Yes | — | — |
| PARIS timing calculator | Yes | — | — |
| Statistics & duration | Yes | — | — |
| Validation utilities | Yes | — | — |
| Tree-shakeable sub-paths | Yes | — | — |
| TypeScript-first | Yes | Partial | — |
| Zero dependencies | Yes | 1 dep | — |
| Roundtrip safe | Yes | — | — |
npm install @morsecodeapp/morseWorks with npm, yarn, pnpm, and bun.
import { encode, decode } from '@morsecodeapp/morse';
encode('SOS'); // '... --- ...'
decode('... --- ...'); // 'SOS'
encode('Hello World'); // '.... . .-.. .-.. --- / .-- --- .-. .-.. -..'Three lines. That's it.
- 11 character sets — ITU, American, Latin Extended, Cyrillic, Greek, Hebrew, Arabic, Persian, Japanese (Wabun), Korean (SKATS), Thai
- Audio playback — Web Audio API player with play/pause/stop, gain envelope, event callbacks
- WAV export — 44.1 kHz 16-bit PCM, works in any JS runtime
- 6 sound presets — telegraph, radio, military, sonar, naval, beginner
- 10 prosigns — SOS, AR, SK, BT, KN, AS, CL, CT, SN, HH
- PARIS timing — standard and Farnsworth spacing, duration estimates
- Validation — check morse syntax, encodability, find unsupported characters
- Statistics — dots, dashes, signal count, duration in ms/sec
- Zero dependencies — nothing but your code
- Tree-shakeable — import from
@morsecodeapp/morse/coreor@morsecodeapp/morse/audio - TypeScript-first — strict types, full
.d.ts, zeroany - ESM + CJS — works in Node.js, Bun, Deno, and browsers (via bundler)
- Roundtrip safe —
decode(encode(text)) === textfor all supported characters
import { encode } from '@morsecodeapp/morse';
encode('ПРИВЕТ', { charset: 'cyrillic' }); // '.--. .-. .. .-- . -'
encode('SOS', { dot: '•', dash: '—' }); // '••• ——— •••'import { encodeDetailed } from '@morsecodeapp/morse';
const result = encodeDetailed('A§B');
// { morse: '.- ? -...', valid: false, errors: ['§'] }import { encodeProsign, decodeProsign, PROSIGNS } from '@morsecodeapp/morse';
encodeProsign('SOS'); // '...---...'
decodeProsign('...---...'); // 'SOS'
PROSIGNS.length; // 10import { timing, farnsworthTiming } from '@morsecodeapp/morse';
const t = timing(20);
// { unit: 60, dot: 60, dash: 180, intraChar: 60, interChar: 180, interWord: 420 }
const ft = farnsworthTiming(10, 20);
// Characters at 20 WPM, overall pace slowed to 10 WPMimport { stats } from '@morsecodeapp/morse';
stats('... --- ...');
// { dots: 6, dashes: 3, signals: 9, characters: 3, words: 1,
// durationMs: 1620, durationSec: '1.6', durationFormatted: '1.6s' }import { isValidMorse, isEncodable, findInvalidChars } from '@morsecodeapp/morse';
isValidMorse('... --- ...'); // true
isEncodable('HELLO', 'itu'); // true
findInvalidChars('A§B'); // ['§']import { detectCharset, listCharsets } from '@morsecodeapp/morse';
detectCharset('ПРИВЕТ'); // 'cyrillic'
listCharsets(); // ['itu', 'american', 'latin-ext', 'cyrillic', ...]Full API documentation with all options and return types → API.md
import { MorsePlayer } from '@morsecodeapp/morse/audio';
const player = new MorsePlayer({ wpm: 20, frequency: 600 });
await player.play('Hello World');import { MorsePlayer, presets } from '@morsecodeapp/morse/audio';
const player = new MorsePlayer(presets.telegraph);
await player.play('CQ CQ CQ');import { toWav, downloadWav } from '@morsecodeapp/morse/audio';
// Raw WAV bytes (works in Node.js, Bun, Deno, browsers)
const wavBytes = toWav('SOS', { frequency: 800 });
// One-click download in the browser
downloadWav('SOS', { filename: 'sos.wav' });const player = new MorsePlayer({
wpm: 15,
onSignal: (signal, idx) => console.log(signal), // 'dot' | 'dash'
onCharacter: (char, morse, idx) => console.log(char, morse),
onProgress: (current, total) => console.log(`${current}/${total} ms`),
});
await player.play('SOS');Available presets:
telegraph,radio,military,sonar,naval,beginner
For minimal bundle size, import from sub-paths:
// Core only — encode, decode, charsets, timing, validation
import { encode, decode } from '@morsecodeapp/morse/core';
// Audio only — player, WAV export, presets
import { MorsePlayer, toWav } from '@morsecodeapp/morse/audio';Each sub-path is independently tree-shakeable. The root @morsecodeapp/morse re-exports everything.
| ID | Name | Script |
|---|---|---|
itu |
International (ITU-R M.1677-1) | Latin A–Z, 0–9, punctuation |
american |
American Morse | Historical telegraph variant |
latin-ext |
Latin Extended | Accented European characters |
cyrillic |
Russian / Cyrillic | А–Я |
greek |
Greek | Α–Ω |
hebrew |
Hebrew | א–ת |
arabic |
Arabic | Arabic alphabet |
persian |
Persian (Farsi) | Extended Arabic for Farsi |
japanese |
Japanese (Wabun) | Katakana syllabary |
korean |
Korean (SKATS) | Jamo consonants & vowels |
thai |
Thai | Thai consonants, vowels, tone marks |
Encode, decode, validate — the foundation.
- 11 character sets (ITU, American, Cyrillic, Greek, Hebrew, Arabic, Persian, Japanese, Korean, Thai, Latin Extended)
- 10 prosigns (SOS, AR, SK, BT, KN, AS, CL, CT, SN, HH)
- PARIS standard + Farnsworth timing
- Statistics, validation, charset detection
- ESM + CJS, TypeScript-first, zero dependencies
- 99%+ test coverage
Hear your Morse code.
-
MorsePlayerclass — Web Audio API playback with play/pause/stop - WAV export (44.1 kHz, 16-bit PCM)
- 6 sound presets — telegraph, radio, military, sonar, naval, beginner
- Gain envelope — clean start/stop, no audio clicks
- Configurable frequency, WPM, volume, and waveform
- Event callbacks — onSignal, onCharacter, onProgress, and more
- Scheduler — timed tone/silence events for custom rendering
See it. Tap it.
- Screen flash / LED controller
- Vibration API output
- Tap-to-morse decoder (touch/click timing → text)
Drop-in components for React apps.
-
useMorse()hook -
<MorsePlayer />audio component -
<MorseVisualizer />waveform component
Decode Morse from real audio.
- Real-time audio decoding (Goertzel algorithm)
- Microphone input
- Audio file decoding
Contributions are welcome. Please read the Contributing Guide before opening a Pull Request.
git clone https://github.com/AppsYogi-com/morsecodeapp.git
cd morsecodeapp
npm install
npm test # Run tests
npm run build # ESM + CJS + DTS
npm run lint # Type checkBuilt and maintained by the team behind MorseCodeApp.com — a comprehensive suite of Morse code tools used by thousands of people every month.