{"id":3951,"date":"2022-12-29T18:21:23","date_gmt":"2022-12-29T18:21:23","guid":{"rendered":"http:\/\/kevinbk.com\/?p=3951"},"modified":"2022-12-29T18:37:30","modified_gmt":"2022-12-29T18:37:30","slug":"customizando-codigo-do-responsivevoice","status":"publish","type":"post","link":"https:\/\/kevinbk.com\/en\/customizing-responsivevoice-code\/","title":{"rendered":"Customizing ResponsiveVoice Code"},"content":{"rendered":"
ResponsiveVoice is a popular free Speech Text API tool that allows users to add reading text, words and snippets to their website. But how to customize these codes to perform the way you want? <\/p>\n\n\n\n
ResponsiveVoice despite being free, has a paid plan that supports it. The big problem is that free users don't get attention. Neither API documentation will update what the service provides. <\/p>\n\n\n\n
When trying to use and edit various codes, I couldn't get it to work the way I want. Fortunately with the help of AI, after several hours, I managed to edit the way I want with JavaScript. <\/p>\n\n\n\n
To add ResponsiveVoice to your website, you need to create an account and generate an API key for your website. Then just put the following Script in the header of your project. <\/p>\n\n\n\n
<script src=\"https:\/\/code.responsivevoice.org\/responsivevoice.js?key=YOUR_UNIQUE_KEY\"><\/script><\/code><\/pre>\n\n\n\nAfter adding this Script, you can create other javascript to make it work on your site. You can call the API to pronounce text of your choice, using strings, variables or predetermined texts. <\/p>\n\n\n\n
It is possible to make the Script pronounce specific tags, selected text or even the whole page. For that, you just need to create the javascript and call the responsivevoice with the following code: <\/p>\n\n\n\n
responsiveVoice.speak(\"text-or-var\");<\/code><\/pre>\n\n\n\nAdding parameters in responsiveVoice.Speak<\/h2>\n\n\n\n
To customize the ResponsiveVoice code, you can use the configuration options available in the ResponsiveVoice documentation. Some of the most common options include:<\/p>\n\n\n\n
\nvoice<\/code>: Lets you specify the voice that will be used to play the text (the language). You can choose from available voices for the selected language.<\/li>\n\n\n\nrate<\/code>: Allows you to control the speech rate. Higher values will result in faster speech, while lower values will result in slower speech.<\/li>\n\n\n\npitch<\/code>: Allows you to control the speech pitch. Higher values will result in higher-pitched speech, while lower values will result in lower-pitched speech.<\/li>\n\n\n\nvolume<\/code>: Allows you to control the speaking volume. Higher values will result in louder speech, while lower values will result in quieter speech.<\/li>\n<\/ol>\n\n\n\nTo use these options, simply add them as parameters when calling the function responsiveVoice.speak()<\/code>.<\/p>\n\n\n\n