Sunday, May 1, 2016

MCS: Morse Code Simulator

Update May 2, 2016

OUTPUT

Sorry, your browser doesn't support web audio API (HTML5) -- for audio synthesis.

How to Use

  • Type the text you wanna "Morse" on the input box. The pattern for each character will be right away displayed on the OUTPUT part.
  • Click PLAY to see the blinking light (default) and to hear the output (if your browser supports Web Audio API -- HTML5).
  • Click STOP to stop the ongoing sequence.
  • Click CLEAR to stop everything, clear input and output, and also to reset all settings to default.

Implemented Browser API

  • Web Audio (HTML5) -- for synthesizing the audio signal -- via JavaScript.
  • "Native" JavaScript for controlling the dilly.
  • CSS to style the HTML elements.
  • HTML elements as the interface.

Basic Mapping (without the Web Audio)

Go to this CodePen doodle


Default

  • The default 523 for the frequency is around C5 note -- 523.25 Hz.
    Minimum of 20 Hz and max of 20,000 Hz (20 kHz).
  • The default volume is 0.5 (50%).
  • The oscillation type options:
    1. SINE
    2. SQUARE
    3. SAWTOOTH
    4. TRIANGLE
  • The base duration is around 60 ms -- which then using dynamic multipliers to generate the Morse's sequence.

About

This tool is the basic idea, especially the audio synthesizing part. No other filter attached besides initialization, on, and off.

For the audio generation, the key is to connect and disconnect the AudioNode with dynamic interval (certain duration). It's also bound with the blinking light.
This tool was mainly produced out of curiosity and appreciation.

If you're interested to develop more complex system, there are lots of references on MDN (Mozilla Developer Network) to read. This superb browser API (Application Programming Interface -- in JavaScript -- language for internet browser) has a lot of new keywords, features, and something something to remember and to tinker around. There are examples too. Neat documentation.