JavaScript SpeechSynthesis API


As the online continues to be the medium for all customers, requirements our bodies must proceed to supply new APIs to complement consumer expertise and accessibility. One underused API for unsighted customers is speechSynthesis, an API to programmatically direct the browser to audibly converse any arbitrary string.

The Code

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

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

speechSynthesis.converse will robotically inform the consumer something you present as a SpeechSynthesisUtterance string. Assist for this API is offered in all fashionable browsers.

I would not contemplate speechSynthesis as a alternative for native accessibility instruments, however this API may very well be used to enhance what native instruments present!

  • 7 Essential JavaScript Functions

    I keep in mind the early days of JavaScript the place you wanted a easy perform for almost every part as a result of the browser distributors applied options in a different way, and never simply edge options, primary options, like addEventListener and attachEvent.  Occasions have modified however there are nonetheless a couple of capabilities every developer ought to…

  • 5 More HTML5 APIs You Didn’t Know Existed

    The HTML5 revolution has supplied us some superior JavaScript and HTML APIs.  Some are APIs we knew we have wanted for years, others are innovative cell and desktop helpers.  No matter API energy or objective, something to assist us higher do our job is a…

  • Select Dropdowns, MooTools, and CSS Print

    I do know I’ve harped on this again and again nevertheless it’s vital to boost pages for print. You are able to do some issues utilizing easy CSS however at this time’s put up options MooTools and jQuery. We’ll be taking the choices of a SELECT factor and producing…

  • Get Slick with MooTools Kwicks

    After I first noticed MooTools graphical navigation, I used to be impressed. I believed it was a quite simple but artistic approach of utilizing Flash. After I right-clicked and noticed that it was JavaScript, I used to be floored. How may they obtain such…


Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles