Text to speech method in anvil?

Yesterday, I implemented speech to text in my search function and it works perfectly. But I also wish to add a text to speech now. Being a total newbie when it comes to Javascript, I don’t know how to achieve this. I was only able to add the speech-to-text method due to a clone link I found on the forum. How can I similarly do it for text to speech?

This is certainly something that’s possible. Especially using the anvil.js tools

Anvil Docs | Using JavaScript


With the speech to text I mostly followed the documentation at mdn:

Using the Web Speech API - Web APIs | MDN

and adapted this example app to work in anvil

web-speech-api/speech-color-changer at master · mdn/web-speech-api · GitHub


for text to speech - mdn has similar docs:

Using the Web Speech API - Web APIs | MDN

And an example:

web-speech-api/speak-easy-synthesis at master · mdn/web-speech-api · GitHub


When we get into the realms of working with javascript it can feel quite off-piste.
And definitely worth taking the time to read over the docs for anvil.js.

Here are some other recent examples that use anvil.js from the forum and the anvil blog

New: anvil.js.window

Integrate Mapbox into your Web App using only Python

Thanks for the reply.
I couldn’t make it work due to not knowing much about javascript(I tried comparing the speech to text and text to speech javascript and then studying my text to speech anvil project). However, I noticed that Anvil already has pyttsx3 and gtts and they are definitely simpler in my opinion so I’ll use them with uplink until I upgrade my plan.

By the way, I applied for a 7-day trial and got the confirmation email but it doesn’t seem to be working.