DIY Voice Assistant

I recently released FAlexa for those who love the concept of programmable Alexa Skills, but not so much Amazon listening to you all day!  You can now speak some verbal commands, and FAlexa (pronounced F-Alexa, I’ll leave the F to your imagination) will fuzzily match that to your own Javascript functions. This lets you say things like “command X” and map it to f(X) in your browser app in just about the simplest way possible!

Demo

(Re-click after speaking to re-listen)

This demo has all the commands in the examples folder, so if you’re on Chrome, you can trigger these skills:

Timers
1. “Set <Timer Name> timer for <Numeric> <‘seconds/minutes/hours’>”

2. “Stop <Timer Name> timer”

Notes
1. “Save note <Note Name> with <Note>”

2. “Read note <Note Name>”

3. “List notes”

Calculate
“<Add/Multiply/Divide/Subtract> <Numeric> <to/by> <Numeric>”

Crazy Typescript Ramblings

Use it.  This was also a great chance to push the limits of Typescript to see how well it does in practice for a decently sized greenfield application.  I purposely wrote the entire FAlexa app from A-Z without any form of testing just to see how much the type system wouldn’t catch, using the most strict Typescript settings, 98% immutable functional programming, no classes, and generics whenever I got the slightest excuse. The result was a mere 3(!) logic bugs that were pretty easy to find once I finally hit Run. That’s with tens of thousands of lines of code! For the first time I’m almost starting to question fine-grained Test Driven Development.

Overall Typescript felt exactly like Go but with an advanced Scala-like generic type system that blows most languages away. My own feeling is that if you’re writing a web application with more than 1000 lines of code, you should consider using Typescript over Javascript, assuming you can take the extra day or two to learn the ins and outs of using Node tooling with Typescript.  The wonky but practical type system takes a little getting used to as well.

Leave a Reply

Your email address will not be published. Required fields are marked *