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
Related tools:
Full toolkit: devtools-site-delta.vercel.app
Top comments (0)