npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@morsecodeapp/morse

v0.2.0

Published

The most complete Morse code library for JavaScript & TypeScript. Encode, decode, audio playback, tap input, and more — zero dependencies.

Readme

@morsecodeapp/morse

The most complete Morse code library for JavaScript and TypeScript.

Encode, decode, play, and export — with 11 character sets, audio playback, WAV export, prosigns, PARIS timing, and Farnsworth spacing. Zero dependencies.

npm version bundle size tests license

Install · Quick Start · Audio · API Reference · Report Bug


Why this library?

| | @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 | — | — |


Install

npm install @morsecodeapp/morse

Works with npm, yarn, pnpm, and bun.


Quick Start

import { encode, decode } from '@morsecodeapp/morse';

encode('SOS');         // '... --- ...'
decode('... --- ...'); // 'SOS'

encode('Hello World'); // '.... . .-.. .-.. --- / .-- --- .-. .-.. -..'

Three lines. That's it.


Features

  • 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/core or @morsecodeapp/morse/audio
  • TypeScript-first — strict types, full .d.ts, zero any
  • ESM + CJS — works in Node.js, Bun, Deno, and browsers (via bundler)
  • Roundtrip safedecode(encode(text)) === text for all supported characters

Usage Examples

Encode with different charsets

import { encode } from '@morsecodeapp/morse';

encode('ПРИВЕТ', { charset: 'cyrillic' }); // '.--. .-. .. .-- . -'
encode('SOS',    { dot: '•', dash: '—' }); // '••• ——— •••'

Detailed results with error info

import { encodeDetailed } from '@morsecodeapp/morse';

const result = encodeDetailed('A§B');
// { morse: '.- ? -...', valid: false, errors: ['§'] }

Prosigns

import { encodeProsign, decodeProsign, PROSIGNS } from '@morsecodeapp/morse';

encodeProsign('SOS');       // '...---...'
decodeProsign('...---...'); // 'SOS'
PROSIGNS.length;            // 10

Timing calculations

import { 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 WPM

Statistics

import { stats } from '@morsecodeapp/morse';

stats('... --- ...');
// { dots: 6, dashes: 3, signals: 9, characters: 3, words: 1,
//   durationMs: 1620, durationSec: '1.6', durationFormatted: '1.6s' }

Validation

import { isValidMorse, isEncodable, findInvalidChars } from '@morsecodeapp/morse';

isValidMorse('... --- ...'); // true
isEncodable('HELLO', 'itu'); // true
findInvalidChars('A§B');     // ['§']

Charset detection

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


Audio Playback

Play Morse audio in the browser

import { MorsePlayer } from '@morsecodeapp/morse/audio';

const player = new MorsePlayer({ wpm: 20, frequency: 600 });

await player.play('Hello World');

Use a sound preset

import { MorsePlayer, presets } from '@morsecodeapp/morse/audio';

const player = new MorsePlayer(presets.telegraph);
await player.play('CQ CQ CQ');

Export to WAV

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' });

Event callbacks

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


Tree Shaking

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.


Supported Character Sets

| 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 |


Roadmap

Phase 1 — Core ✅ v0.1.0

Encode, decode, validate — the foundation.

  • [x] 11 character sets (ITU, American, Cyrillic, Greek, Hebrew, Arabic, Persian, Japanese, Korean, Thai, Latin Extended)
  • [x] 10 prosigns (SOS, AR, SK, BT, KN, AS, CL, CT, SN, HH)
  • [x] PARIS standard + Farnsworth timing
  • [x] Statistics, validation, charset detection
  • [x] ESM + CJS, TypeScript-first, zero dependencies
  • [x] 99%+ test coverage

Phase 2 — Audio 🔊 v0.2.0

Hear your Morse code.

  • [x] MorsePlayer class — Web Audio API playback with play/pause/stop
  • [x] WAV export (44.1 kHz, 16-bit PCM)
  • [x] 6 sound presets — telegraph, radio, military, sonar, naval, beginner
  • [x] Gain envelope — clean start/stop, no audio clicks
  • [x] Configurable frequency, WPM, volume, and waveform
  • [x] Event callbacks — onSignal, onCharacter, onProgress, and more
  • [x] Scheduler — timed tone/silence events for custom rendering

Phase 3 — Visual + Tap 📱 v0.3.0

See it. Tap it.

  • [ ] Screen flash / LED controller
  • [ ] Vibration API output
  • [ ] Tap-to-morse decoder (touch/click timing → text)

Phase 4 — React ⚛️ v0.4.0

Drop-in components for React apps.

  • [ ] useMorse() hook
  • [ ] <MorsePlayer /> audio component
  • [ ] <MorseVisualizer /> waveform component

Phase 5 — Decoder 🧠 v0.5.0

Decode Morse from real audio.

  • [ ] Real-time audio decoding (Goertzel algorithm)
  • [ ] Microphone input
  • [ ] Audio file decoding

Contributing

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 check

About

Built and maintained by the team behind MorseCodeApp.com — a comprehensive suite of Morse code tools used by thousands of people every month.

License

MIT © MorseCodeApp