Search code examples
javascriptgoogle-chrometext-to-speechgoogle-text-to-speechwebspeech-api

Odd behaviour in Google Web Speech API


I'm working with Google's Web Speech API using Google Chrome (55.0.2883.87) and I'm experiencing some very weird behaviour.

When attempting to speak out names, followed by a number (like John 4) it usually just speaks out the name and the number, as it should - but for some names it puts the word chapter between the name and the number, so Daniel 4 becomes Daniel Chapter 4.

I have picked up some random names and tested them with the following code:

<script>
var names = ['Brian', 'John', 'Mike', 'Julia', 'Daniel', 'Michael', 'David', 'Jason', 'Jack'];

names.forEach(function(name) {
  var msg = new SpeechSynthesisUtterance(name + ' 4');
  window.speechSynthesis.speak(msg);
});
</script>

The msg variable doesn't include the word chapter when logging it with console.log()

Of these 9 names, the names John and Daniel are spoken with the word chapter between them.

Question

Why does this happen, and which criteria determines which names are affected?


Solution

  • I think that one of your homonyms wrote something in a famous book, and a certain John did too. I would guess that it does the same for Jeremiah or these others.

    But I can't repro neither on my 55.0.2883.95 nor on my 57.0.2954.0 on mac...

    Maybe it was a Christmas Easter egg.

    so many religious parts in this answer...