Decode Morse code from a blinking light or a beeping tone in any video or audio file, then play it back with a live decoder synced to the media.
Everything runs in the browser: files are never uploaded.
npm install
npm run dev # http://localhost:5173Drop in a video or audio file (or use one of the two samples on the start screen).
Other commands:
npm test # decoder tests (synthetic signals + the bundled samples)
npm run build # static site in dist/ (deploy anywhere; uses relative paths)
npm run decode -- path/to/file.mp4 [--source auto|light|sound] [--wpm 15] [--tone 700] [-o out.json] [--srt out.srt]
npm run make-sample # regenerate the bundled samples in public/samples/ (needs ffmpeg)The CLI needs ffmpeg on PATH. The web app needs nothing else.
Start: drop a file in, or try one of the two bundled samples.
Decode a light: the app finds the blinking light by itself and outlines it on the video. While it plays you see:
- a lamp indicator, which is on when the signal is on,
- the marks of the letter being keyed right now,
- a signal trace with the raw level, the adaptive threshold and each dot and dash (click it to seek),
- the message as it builds up,
- the source, speed, dot length and confidence.
The light screenshot at the top of this page shows all of these.
Point at the light: if it locks onto the wrong thing, press Point at the light and tap the lamp. Find automatically switches back to automatic detection. Decode from switches between the light and the sound track when a video has both, with each one's confidence. Speed fixes the WPM if auto-detection struggles. Half speed and Loop help you follow along.
Decode a sound: for audio, the app finds the Morse tone (here 640 Hz in noise and hum) and lights a lamp in time with it.
Letter by letter, key and exports: tap any letter to jump to it. A dashed border marks a letter cut off by the start or end of the clip (this one was filled in from a repeat of the message). The key lists every character in the message. Export the transcript, subtitles, raw data, or a decoder video with the live panel beside the clip.
On a phone: the layout stacks into one column.
- Light: scans every frame and finds the region and colour channel that switch on and off most cleanly. It works with any colour, ignores global exposure flicker, and handles rotated phone video. If it picks the wrong thing, use Point at the light and tap the light.
- Sound: finds the Morse tone, i.e. the frequency that switches between loud and quiet, ignoring hum and broadband noise. It then follows that tone with a narrow filter matched to the sending speed.
- Auto: for a video with audio, both tracks are decoded and the more convincing one is shown. You can switch between them.
- Timing: an adaptive threshold handles fading and dusk light. The decoder estimates dot, dash and gap lengths from the signal itself, removes glitches, handles Farnsworth (stretched) spacing and sloppy hand-keying, and splits run-together letters.
- Clipped letters: a letter cut off by the start or end of the clip is shown with a dashed border. If the message repeats, the letter is filled in from another repeat.
- Confidence: each letter, and the decode as a whole, gets a confidence score. Noise, music and random beeps score low, so the app says when it found nothing instead of making up a message.
- Exports: transcript (.txt), subtitles (.srt / .vtt), raw data (.json), and a decoder video: the clip with a live decoder panel beside it, recorded in real time with the original audio.
| Path | What it is |
|---|---|
src/core/ |
Pure TypeScript decoder, shared by the web app, CLI and tests. light.ts (frames → light level), audio.ts (PCM → tone envelope), signal.ts (thresholding), timing.ts (on/off → letters), pipeline.ts (ties it together), export.ts, synth.ts (test-signal generator). |
src/media/ |
Browser media loading. frames.ts uses WebCodecs + mp4box for MP4/MOV, and falls back to frame-by-frame playback capture for other formats. audio.ts uses Web Audio. |
src/worker.ts |
Runs decoding off the main thread. |
src/main.ts, src/ui/ |
The app: player, signal views, controls, exports, decoder-video recorder. |
cli/ |
Node CLI (ffmpeg for media loading). |
tests/ |
Vitest suite: synthetic signals, the bundled samples, and (optionally) your own footage via MORSE_GOLDEN_DIR. |
public/samples/ |
Generated demo media (npm run make-sample): a blinking lamp video and a noisy radio tone. |
prototype/ |
The original Python prototype and static player, kept for reference. |
The app is current in Chrome, Edge and Safari. Firefox works too, but decodes video through the slower real-time playback path. The decoder video is MP4 where the browser can record MP4, otherwise WebM.
- The light should stay roughly still in the frame. Heavy camera shake or a moving light isn't tracked yet.
- Very fast light Morse needs a frame rate to match: a dot should last at least 2 frames (at 30 fps, about 35 WPM at most).
- One signal at a time: two lights, or two tones on top of each other, aren't separated.
MIT. See LICENSE.





