JavaScript SpeechSynthesis API

Date:

Share post:

As the web continues to be the medium for all users, standards bodies need to continue to provide new APIs to enrich user experience and accessibility. One underused API for unsighted users is speechSynthesis, an API to programmatically direct the browser to audibly speak any arbitrary string.

The Code

You can direct the browser to utter speech with window.speechSynthesis and SpeechSynthesisUtterance:

window.speechSynthesis.speak(
    new SpeechSynthesisUtterance('Hey Jude!')
)

speechSynthesis.speak will robotically tell the user anything you provide as a SpeechSynthesisUtterance string. Support for this API is available in all modern browsers.

I wouldn’t consider speechSynthesis as a replacement for native accessibility tools, but this API could be used to improve what native tools provide!

Request Metrics real user monitoring
Request Metrics real user monitoring
Request Metrics real user monitoring
  • Write Better JavaScript with Promises

    Write Better JavaScript with Promises

    You’ve probably heard the talk around the water cooler about how promises are the future. All of the cool kids are using them, but you don’t see what makes them so special. Can’t you just use a callback? What’s the big deal? In this article, we’ll…

  • Interview with a Pornhub Web Developer
  • TextboxList for MooTools and jQuery by Guillermo Rauch

    TextboxList for MooTools and jQuery by Guillermo Rauch

    I’ll be honest with you: I still haven’t figured out if I like my MooTools teammate Guillermo Rauch. He’s got a lot stacked up against him. He’s from Argentina so I get IM’ed about 10 times a day about how great Lionel…

  • JavaScript Canvas Image Conversion

    JavaScript Canvas Image Conversion

    At last week’s Mozilla WebDev Offsite, we all spent half of the last day hacking on our future Mozilla Marketplace app. One mobile app that recently got a lot of attention was Instagram, which sold to Facebook for the bat shit crazy price of one…


Source link
spot_img

Related articles

Gollumfun (Part 2) – Darknet Diaries

Full Transcript Brett Johnson, AKA Gollumfun (twitter.com/GOllumfun) was involved with the websites Counterfeit Library and...

This $2699 MSI RTX 5090 is the cheapest you’ll find right now

At $1999 and up, no RTX 5090 can be described as cheap. But we've been searching far and...

Event Registration for 500+ Employee Conferences

When you are planning an internal conference for 500 or more employees, registration is more than a form....

New Gemini API updates for Gemini 3

Gemini 3, our most intelligent model is available for developers to build with via...