Hello,
Workflow:
Text Form -> submit -> preset e.g. lang Italian and voice Microsoft Elsa - Italian (Italy) for SpeechSynthesisUtterance -> that synthesis make as MP3 source for audio stream.
Is it possible?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Yes, it’s possible to preset the language and voice for
SpeechSynthesisUtterance
in JavaScript and convert that to an audio stream. However, the Web Speech API, which provides text-to-speech functionality, does not natively support exporting audio to a file (like MP3). You’d typically need a server-side solution for that, but I can show you how to set up the client-side TTS and play it back in the browser.Here’s an example of how you can use
SpeechSynthesisUtterance
to set the language and voice, and then play the audio in the browser:Explanation:
SpeechSynthesisUtterance
object with the specified text, language (it-IT
for Italian), and selected voice.speechSynthesis.speak()
method is called to play the speech.Note:
'it-IT'
with any other language code supported by the Web Speech API.SpeechSynthesisUtterance
does not directly support saving the output as an MP3 file; you’d need to use a server-side text-to-speech API for that.Hi there,
Yes, this workflow should be possible.
What you could do is:
Feel free to give current setup and I will be happy to help out.
Also if you are hitting any issues, feel free to share the errors here as well.
- Bobby