Female voice in google chrome speechSynthesis


Im using this exact code in both the scenarios.

var msg = new SpeechSynthesisUtterance(); var voices = window.speechSynthesis.getVoices(); msg.voice = voices[1]; msg.text = "hello world"; msg.lang = 'en-US'; speechSynthesis.speak(msg);

If I run this in the chrome console I get a female voice. But if I put the exact code in an index.html and run it, it plays a male voice. Could any one please clarify why this difference occurs. Thanks in advance.


Found the Root cause. <a href="https://stackoverflow.com/questions/21513706/getting-the-list-of-voices-in-speechsynthesis-of-chrome-web-speech-api" rel="nofollow">Getting the list of voices in speechSynthesis of Chrome (Web Speech API)</a>

The calls are async, so when I try to run in index.html the voices array is empty. As I suggested when I run this and then use the speak it works fine.

var msg; var voices; var timer = setInterval(function() { voices = speechSynthesis.getVoices(); console.log(voices); if (voices.length !== 0) { msg = new SpeechSynthesisUtterance(); msg.voice = voices[0]; speechSynthesis.speak(msg); msg.lang = 'en-US'; clearInterval(timer); } }, 200); timer(); speechSynthesis.speak("hello world");


  • Replacing accents w/ their counterparts in AS3
  • Are there any fluent WPF projects? [closed]
  • C# 4 and CLR Compatibility
  • Watson Conversation - Why is the ANYTHING ELSE node not chosen
  • pickle.PicklingError: args[0] from __newobj__ args has the wrong class with hadoop python
  • Using $compile in a directive triggers AngularJS infinite digest error
  • How can I include If-None-Match header in HttpRequestMessage
  • What does 'Language neutral' mean with regard to MAKELANGID?
  • Is playing sound in Javascript performance heavy?
  • Parse a date string in a specific locale (not timezone!)
  • Android activity accessing service's static reference before the service is ready
  • Problem deserializing objects from cache on MyBatis 3/Java
  • Chrome doesn't support silverlight anymore? How to solve this?
  • Java: can you cast Class into a specific interface?
  • PHPUnit_Framework_TestCase class is not available. Fix… - Makegood , Eclipse
  • Display issues when we change from one jquery mobile page to another in firefox
  • Ajax jQuery multiple calls at the same time - long wait for answer and not able to cancel
  • AES padding and writing the ciphertext to a disk file
  • Updating server-side rendering client-side
  • How to extract text from Word files using C#?
  • MySQL WHERE-condition in procedure ignored
  • Where to put my custom functions in Wordpress?
  • Javascript convert timezone issue
  • jquery mobile loadPage not working
  • Web-crawler for facebook in python
  • Do I've to free mysql result after storing it?
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Python - Map / Reduce - How do I read JSON specific field in using DISCO count words example
  • SVN: Merging two branches together
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • How to get icons for entities from eclipse?
  • trying to dynamically update Highchart column chart but series undefined
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • coudnt use logback because of log4j
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • JaxB to read class hierarchy
  • Conditional In-Line CSS for IE and Others?
  • java string with new operator and a literal