Skip to main content

CW Decoder

In Development

The CW Decoder is under active development and is not yet fully functional. The signal processing pipeline and UI are in place, but real-world decoding accuracy is still being refined.

The CW Decoder listens to Morse code audio through your device's microphone and translates it into text in real time. Place your phone or tablet near your radio's speaker and watch the decoded characters appear on screen.

Getting Started

  1. Open CW Decoder from the sidebar or tools menu.
  2. If you have multiple microphones, select one from the Mic dropdown.
  3. Tap Start to begin recording.
  4. Grant microphone permission when prompted.
  5. Hold your device near your radio's speaker.

[SCREENSHOT: CW Decoder tool with the Start button and empty decode area ready for use]

Microphone permission required

The CW Decoder needs access to your device's microphone. If you accidentally deny permission: on the web, the tool shows browser-specific instructions for re-enabling it in Chrome, Firefox, Safari, or Edge. On Android, re-enable microphone access in Settings > Apps > Hamtrax > Permissions. On iOS, go to Settings > Hamtrax and toggle Microphone on.

How It Works

The decoder uses a five-phase signal processing pipeline:

  1. Phase 1 -- Raw Audio: Captured from your microphone, displayed as a full-spectrum spectrogram (0--2000 Hz).
  2. Phase 2 -- Bandpass Filter: A 6th-order Butterworth filter isolates frequencies between 500 and 700 Hz, removing everything outside that range.
  3. Phase 3 -- Noise Gate: A volume threshold gate zeroes out bins below the threshold and hard-limits bins above it to maximum (binary: signal or silence).
  4. Phase 4 -- Binary Gate: Checks whether any frequency bin in the passband survived the noise gate, producing a simple ON/OFF signal per time tick.
  5. Phase 5 -- Morse Decoder: Reads the boolean ON/OFF stream, classifies key-down durations as dits or dahs, detects character and word boundaries, and outputs decoded text.

The decoder automatically adapts to the sending speed. It clusters recent ON durations using k-means (k=2) to find the natural dit/dah boundary. All other timing thresholds are derived from the measured dit length: dah threshold is the midpoint between the two clusters, character spacing is dit length times 2, and word spacing is dit length times 5. Until at least 6 ON-duration samples arrive, the WPM slider provides fallback thresholds.

Controls

ControlAction
Mic dropdownSelect which microphone to use (shown when multiple devices are available)
StartBegin recording and decoding
PauseStop recording but keep decoded text and visualizations
StopStop recording and clear all data (shown only while paused)
Volume ThresholdAdjust the noise gate to filter out background noise (inside Phase 3 panel)
WPM sliderSet initial/fallback words-per-minute for timing thresholds (5--40, inside Phase 5 panel)
CopyCopy decoded text to your clipboard
Expand / CollapseShow or hide each spectrogram phase individually
Adjusting the volume threshold

If the decoder is triggering on background noise, increase the Volume Threshold slider. If it is missing characters, lower it. The goal is to find the sweet spot where only the CW tone triggers the gate.

Spectrograms and Visualizations

Each phase has its own visualization panel. Phases 1--3 can be individually expanded or collapsed.

  • Phase 1 -- Raw Audio: Full-spectrum spectrogram (0--2000 Hz) plus an amplitude envelope showing overall mic input level.
  • Phase 2 -- Bandpass Filter: Same frequency range as Phase 1, but only the 500--700 Hz band has signal. Includes its own amplitude envelope.
  • Phase 3 -- Noise Gate: Zoomed spectrogram of the 500--700 Hz band after the volume threshold is applied. Includes its own amplitude envelope.
  • Phase 4 -- Binary Gate: A step-function waveform showing ON/OFF keying states over time. Always visible (not collapsible).

These visualizations are helpful for troubleshooting. If you see the CW tone clearly in the Phase 1 spectrogram but nothing in Phase 2, the tone may be outside the 500--700 Hz filter range.

Output

The Phase 5 decoder panel appears once recording begins. It contains three sections:

  • Morse Stream -- the raw sequence of dots (.) and dashes (-) as they are classified.
  • Decoded Text -- the translated alphanumeric characters. Tap Copy to copy this text to your clipboard.
  • Decoder Logic -- a timing reference table showing both WPM-derived and adaptive thresholds (measured dit, dah threshold, character spacing, word spacing), plus a scrolling event log of every timing decision the decoder makes in real time.

Tips for Best Results

  • Position your device close to the speaker -- 6 to 12 inches works well.
  • Reduce background noise as much as possible.
  • The decoder needs at least 6 key-down samples (roughly 2--3 characters) before adaptive timing kicks in. Until then it uses the WPM slider as a fallback.
  • Works best with clean, consistent sending at moderate speeds (10--25 WPM).
info

The CW Decoder is a great learning tool. Even if you are still building your CW skills, watching the decoder work alongside your own copy helps train your ear.