Posts

Showing posts from September, 2016

Generating Morse Code Sounds from Text

Image
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 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 …

Calculating your upcoming Life Crises Events

Image
A friend of mine was having their quarter-life crisis (apparently it's a thing), which happens around the age of 25, so unfortunately I've missed mine already. This got me thinking about all the life crises that I've already missed and have coming up. I wanted to make a script that given my birthday would let me know all about my life crises. Have a 2/7th life crisis party or something, who knows.

So there's the obvious mid-life crisis, which happens around your 40's. Let's assume a lifespan is 100 years, then let's find our mid-life and quarter-life crisis times. On top of that, why not our 1/3 and 2/3 life crises? or even 3/5th of 5/7th. Also, let's put this on a little HTML5/javascript web page that will provide to-the-second accurate estimates for upcoming crises.


Needless to say, this is probably not what one should do when a friend is having a life crisis (they weren't entirely as enthusiastic about this script as I was). Anyway, never let an …