0

I'm creating a program using speech synthesis. On my MacBook Air, I have access to 66 voices and when I try the program on a friend's laptop (a razor blade gaming laptop), he has access to a total of 25 voices. So, when I try to use voice #49 on my laptop (the Google Female Voice), it will be a male voice on my mate's laptop (I assume it by default plays voice # 1 on his laptop which is a Microsoft voice). How can I sort this issue so that the same voice is played across different laptops (using the same Chrome browser)?

I'm thinking perhaps instead of using numbers to generate the voice (see example 1 below), I could make reference to the voiceURI 'Google US English'? I'm not too sure how to do this though.

Example 1: this.utterance.voice = window.speechSynthesis.getVoices()[49]

sperfume
  • 31
  • 5
  • 1
    `const voice = window.speechSynthesis.getVoices().find(v => v.name == 'Google US English')`? – Amadan Jul 27 '22 at 04:40
  • I tried this out but it doesn't seem to be working on my mate's laptop for some reason. I used `this.utterance.voice = window.speechSynthesis.getVoices().find(v => v.name == 'Google US English')` – sperfume Jul 27 '22 at 05:01
  • Then I suppose this voice does not exist on his system? Try `window.speechSynthesis.getVoices().map(v => v.name)` to see what is available and if there are any that you can use on both. – Amadan Jul 27 '22 at 05:03

0 Answers0