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
  • 7 Essential JavaScript Functions

    7 Essential JavaScript Functions

    I remember the early days of JavaScript where you needed a simple function for just about everything because the browser vendors implemented features differently, and not just edge features, basic features, like addEventListener and attachEvent.  Times have changed but there are still a few functions each developer should…

  • Responsive and Infinitely Scalable JS Animations

    Responsive and Infinitely Scalable JS Animations

    Back in late 2012 it was not easy to find open source projects using requestAnimationFrame() – this is the hook that allows Javascript code to synchronize with a web browser’s native paint loop. Animations using this method can run at 60 fps and deliver fantastic…

  • Create a Sheen Logo Effect with CSS
  • AJAX Username Availability Checker Using MooTools

Source link
spot_img

Related articles

LoD – Darknet Diaries

Full Transcript The Legion of Doom (LoD) wasn’t just a “hacker group”, it captured the...

Edifier’s Funky Portable ES300 Wireless Speaker

60W RMS From A 4″ Bass Driver And Dual 1.25″ Silk Dome Tweeters Portable speakers are a confusing product,...

Corporate Event Registration Software: SSO, Approvals, Budget Controls

If you run events for a large organization, registration is no longer just a form on a landing...

Future of AI in Car Wash App Development

The evolution of car wash apps has expanded beyond simplistic bookings and payments. Today, car wash app users...