Morse.js

A jQuery plugin that annotates text with Morse Code

Click on any of the annotated paragraphs below to hear the text played as Morse code.

Demo

Hello World

Morse code was created by Samuel Morse in the 1840s

SOS

Usage

Include the audio module, jQuery, and the plugin, then call morseCode() on your elements:

<script src="src/audio-player.js"></script>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="jquery.morse.js"></script>
<script>
  $("p").morseCode({ wpm: 12 });
</script>

Audio is played via the Web Audio API by default, with a WAV Blob fallback for environments without AudioContext. You can also use the audio module independently:

// Play a symbol string and get a Promise that resolves when done
MorseAudioPlayer.playMorseSymbols("._  _...", { wpm: 12 }).then(() => {
  console.log("playback complete");
});

// Stop immediately
MorseAudioPlayer.stopPlayback();