Skip to content

Instantly share code, notes, and snippets.

@dcorb
Last active January 3, 2016 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcorb/8480504 to your computer and use it in GitHub Desktop.
Save dcorb/8480504 to your computer and use it in GitHub Desktop.
Demo Speech Synthesis API with Ana Botella
// Result: http://www.youtube.com/watch?v=fxdg31ibQU4
// Experiment mixing English language with Spanish voice.
// It sounds like Ana Botella :)
// This feature is now only in Google Chrome Canary (v. 34)
// Some issues I had building this demo:
// * After 200 characters aprox. the speech will stop
// * It won't work with non ASCII characters
// If the speech get's stuck because any of these problems,
// you will need to restart the browser to make it work again.
// Beginner tutorial of Speech Synthesis API
// http://www.broken-links.com/2013/09/20/web-speech-api-part-one-speech-synthesis/
var foo = [];
foo.push(new SpeechSynthesisUtterance("Thank you, Ignacio. President Rogge, Dear IOC members, ladies and gentlemen. I've had the chance to speak to many of you in private conversations"));
foo.push(new SpeechSynthesisUtterance("and also in our presentations in Saint Petersburg and in Lausanne. I must say, I'd like to continue. Our friendship, and frankly, I don't want this to be our last chance to speak to each other!"));
foo.push(new SpeechSynthesisUtterance("So let me tell you a little more. About my beautiful hometown, Madrid. Madrid is one of the most comfortable charming and inviting cities in the world. "));
foo.push(new SpeechSynthesisUtterance("Just like all of Spain. Madrid is an amazing mixture of traditions. You can see, feel and taste the wonder of Spanish culture in Madrid's parks. its food. its art and its architecture."));
foo.push(new SpeechSynthesisUtterance("Perhaps, those of you who have visited Madrid, share this feeling. We have been working hard for many years. so our guests"));
foo.push(new SpeechSynthesisUtterance(" almost eight million each year,feel at home. And most importantly, Madrid is Fun. The Olympic Games are not only a celebration of sport. they are also a celebration of life."));
foo.push(new SpeechSynthesisUtterance("And I assure you, no one celebrates life like the Spanish People do!"));
foo.push(new SpeechSynthesisUtterance("There is nothing quite like a. relaxing cup of cafe con leche in Plaza Mayor, or a quaint romantic dinner in El Madrid de los Austrias, the oldest part of Madrid."));
foo.push(new SpeechSynthesisUtterance("These experiences, and so much more are the heart, and soul of Madrid. So later today, when you are considering your choice for twenty twenty."));
foo.push(new SpeechSynthesisUtterance("I hope you remember that in addition to the best prepared plan, Madrid also offers you a city full of culture fun and welcoming people. The magic of Madrid is real."));
foo.push(new SpeechSynthesisUtterance("And I want to share it with all of you. Muchas Gracias"));
for (var i=0;i<foo.length;i++){
foo[i].lang = 'es-ES';
window.speechSynthesis.speak(foo[i]);
}
@ashokrane
Copy link

Does this work for Spanish? I tried to use 'es-ES' as language, but it still pronounces in English.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment