Morse Code Translator with Audio Playback — Built in JavaScript

Morse Code Translator with Audio Playback — Built in JavaScript

https://ift.tt/qhN36Et

I built a Morse code translator that converts text to dots and dashes — and plays the audio.

The Build

The encoding is straightforward — a lookup table mapping each character to its Morse pattern:

const MORSE = {
  A: ".-", B: "-...", C: "-.-.",
  // ... etc
};

The audio part uses the Web Audio API:

const ctx = new AudioContext();
const osc = ctx.createOscillator();
osc.frequency.value = 600; // classic Morse tone

Dots play for 60ms, dashes for 180ms (3x). Letter gaps are 180ms, word gaps 420ms.

Features

  • Encode text → Morse
  • Decode Morse → text
  • Audio playback at 600Hz
  • Full A-Z, 0-9, punctuation reference chart
  • Copy results

Try the Morse Code Translator

Related tools:

Full toolkit: devtools-site-delta.vercel.app

HI-FI News

via DEV Community: javascript https://ift.tt/9aq0gIZ

March 26, 2026 at 02:09AM