Generating Morse Code Sounds from Text

I decided to port my python morse code script over into a live demo web page (this is because live demos are infinitely easier with HTML5/javascript web pages which are client-side, instead of web server based solutions that would cost me compute resources to run/maintain).

We want to have an input text box, and after the user submits, convert it to a sequence of morse code dots and dashes (dit's and dah's),

Morse Code Generator : Link
Morse code conversion is simple enough, a look-up dictionary. Then to generate the sounds, I actually started with generating the audio data from a python script into base64 encoded strings that was then loaded by the javascript. This mostly worked, with some interesting loading issues on mobile web pages.

I then transitioned to using Tone.js, which is pretty fantastic and provided an easy method for generating the morse code tones programmatically, and with more accurate timing than the existing javascript setTimeout methods (which can lag by several 100ms).

Here's a little demo that you can try out live:

Python Source code
HTML5/Javascript Demo Source code

Popular posts from this blog

Building a PID hover controller for Kerbal Space Program with kOS and IPython Notebook

Learning TensorFlow #1 - Using Computer Vision to turn a Chessboard image into chess tiles

Visualizing TLE Orbital Elements with Python and matplotlib