Using Text to Speech

I keep waiting for the day when computers get as smart and easy to use as the computers in Star Trek. In particular, I can’t wait until the day when all of my computer apps talk to me out loud.

Fortunately, that day has arrived. Windows 8.1 includes a new Text-To-Speech API that makes it easy to add speech to a Windows Store app. The Text-To-Speech API even supports different voices with different genders.

The MyTasks app includes a button, labeled Read Tasks, that reads all of the tasks on the current page out loud. Here’s what the click handler for the button looks like:

// Read tasks out loudbtnRead.addEventListener("click", function (e) {    e.preventDefault();    // Build soliloquy     ...

Get Windows® 8.1 Apps with HTML5 and JavaScript Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.