This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Synthesizes speech from the provided text using the Web Speech API. | |
* @param {string} text - The text to be synthesized. | |
* @param {string} voiceName - The name of the voice to be used. | |
*/ | |
function speak(text, voiceName) { | |
const utterance = new SpeechSynthesisUtterance(text); | |
const voices = window.speechSynthesis.getVoices(); | |
// Find the voice with the specified name |