Skip to content
begoonPublic

About

Morse code trainer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Morse Trainer

A browser-based Morse trainer, shipped as separate GitHub Pages routes with a landing menu. Listen and type characters and words back, key Morse with an iambic paddle or straight key and watch the live decode, or sit one of ten RSGB Foundation mock exams.

Build & run

Each route is a single self-contained HTML file (all JS/CSS inlined) under docs/, served by GitHub Pages from main / docs.

just install        # bun install
just build          # bundle every route into docs/<route>/index.html
just serve          # build, then python3 -m http.server -d docs 3000
just test           # bun test  (typecheck with: bunx tsc --noEmit)

Rebuild after any src/ change and commit docs/ — that's what GitHub Pages serves. You can also open docs/index.html with the VS Code Live Server extension after building (a .vscode/settings.json scopes Live Server to docs/ so it only reloads on rebuilds).

index.ts is an optional bun --hot index.ts dev server (HMR); not the primary path.

Routes

The landing menu (docs/index.html) links to four pages, all sharing one set of settings:

  • Listen (docs/listen/) — a pure listening drill: a target is played as Morse, you copy it in your head and say it aloud, then reveal to check (no typing). Space is the one eyes-free key: a short tap replays, a hold reveals the whole answer (code + letters, optionally spoken). After a reveal the answer lingers ~3 s, then the next target plays automatically (tap / / / click to skip the wait) — so a single finger on the spacebar runs the whole drill without looking, and with the auto-reveal timer on it's fully hands-free. The Word length setting caps the target: 1 = single characters; 2+ = an English word of up to that many letters (≈⅓ of the time from CW jargon / Q-codes). A running line logs the targets you've revealed. Russian always plays single characters.
  • Keying (docs/keying/) — key Morse yourself with an iambic paddle (Curtis Mode A/B), an Ultimatic paddle, or a straight key; it decodes to text live. Space clears the output (unless it's bound as the straight key).
  • Test (docs/test/) — Foundation mock exam runner (see below).
  • Settings (docs/settings/) — alphabet, word length, speed, gap tolerance, key type, keyer mode, volume, and tone, persisted in localStorage and shared by every page.

Keying

  • Paddle (default): [ = dit, ] = dah. Hold for repeats, squeeze both for di-dah alternation (iambic) or last-pressed-wins (Ultimatic). On the on-screen keypad hold both buttons, or use a mouse — left button = dit, right button = dah.
  • Straight key: hold Space — short press = dit, long press = dah.

The paddle keyer has three modes, switchable in Settings:

  • Iambic — Mode A (default) — squeeze both paddles to alternate di-dah; releasing both mid-element finishes the current element and stops.
  • Iambic — Mode B — like Mode A, but releasing both mid-element finishes the current element and then sends one extra opposite element.
  • Ultimatic — a squeeze does not alternate: the most-recently-pressed paddle dominates and repeats (press dit then dah → continuous dahs). Releasing the dominant paddle falls back to the other one if it is still held.

Exam runner

Ten Foundation mock papers (26 single-choice questions each), tagged by source:

  • rsgb — Mock 1–3, extracted from the RSGB mock PDFs.
  • hamtrain — Mock 1–7 (1–6 with a written explanation per question).

Pick a single paper, Combined (a 26-question exam with one question per topic — the papers are topic-ordered, so each of the 26 positions is drawn from a random paper), or Everything (all 260 questions). Options for shuffling questions and answers, and showing the correct answer immediately or only at the end. Pass mark is 19/26, scaled by percentage for longer runs. Some questions include a diagram. The hamtrain answer explanations are shown after you answer (immediate mode) and in the results review.

Features

  • Listening trainer (characters and words) and a free keying mode
  • Switchable paddle keyer (iambic Curtis Mode A/B and Ultimatic) and straight-key keyer
  • Web Audio sidetone with adjustable tone (400–1000 Hz) and volume
  • Live decode to text
  • English and Russian Morse tables
  • Adjustable speed (PARIS standard: dit = 1200 / wpm ms)
  • QWERTY / ЙЦУКЕН cheatsheet keyboard
  • Ten Foundation mock exams (RSGB + hamtrain) with images and explanations
  • All settings persisted in localStorage

Layout

index.html                landing menu
src/listen/                  Listen route (main.ts + index.html + word bank)
src/keying/                Keying route
src/settings-page/         Settings route
src/test/                  Exam runner (quiz.ts logic, question banks, images)
src/morse.ts               EN/RU tables + lookup/encode
src/timing.ts              PARIS timing + straight-key thresholds
src/audio.ts               Web Audio sidetone + error buzz
src/player.ts              plays a pattern as audio
src/keyer-iambic.ts        paddle keyer (iambic Curtis Mode A/B + Ultimatic)
src/keyer-straight.ts      straight-key keyer + press classifier
src/decoder.ts             element stream -> decoded text
src/cheatsheet.ts          QWERTY / ЙЦУКЕН keyboard
src/settings.ts            localStorage settings
src/styles.css             shared styles
build.ts                   bundles each route into self-contained docs/ HTML
tools/                     one-off word-bank and question-bank extractors
foundation/                mock-exam source material (PDFs / markdown / images)
*.test.ts                  unit tests

About

Morse code trainer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages