最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - getVoices() in SpeechSynthesis returns different voices on same system - Stack Overflow

programmeradmin3浏览0评论

atm I am working on a project and want to add a TTS functionality using SpeechSynthesis. It works fine in MS Edge on Windows 11 but not in Firefox on the same machine. I checked the documentation here:

Turns out that in the List Firefox only shows 5 voices whereas Edge shows many more, at least 40 I guess. That is obviously the reason why it won't work in Firefox (French text is read with a German voice e.g.)

I always thought that the browsers use the voices that are installed on the system. How can it be that there is such a difference?

What can I do to get all availabe voices, like in Edge, also in Firefox?

Thank you

atm I am working on a project and want to add a TTS functionality using SpeechSynthesis. It works fine in MS Edge on Windows 11 but not in Firefox on the same machine. I checked the documentation here: https://developer.mozilla./en-US/docs/Web/API/SpeechSynthesis/getVoices

Turns out that in the List Firefox only shows 5 voices whereas Edge shows many more, at least 40 I guess. That is obviously the reason why it won't work in Firefox (French text is read with a German voice e.g.)

I always thought that the browsers use the voices that are installed on the system. How can it be that there is such a difference?

What can I do to get all availabe voices, like in Edge, also in Firefox?

Thank you

Share Improve this question asked Mar 16 at 14:52 DonHSDonHS 211 silver badge3 bronze badges 3
  • 1 If consistency is key, use a third party API. Different browsers will have different voices implemented. – Spectric Commented Mar 16 at 17:45
  • So it depends on the browser? I tested it with Firefox on macOS - everything works fine. Is there also a difference between Firefox on macOS and Windows? – DonHS Commented Mar 16 at 19:07
  • It depends on a variety of factors. Older operating systems don't have TTS. Old browsers dont have TTS. If consistency is what you're striving for, don't use the browser API. – Spectric Commented Mar 16 at 19:14
Add a comment  | 

1 Answer 1

Reset to default 0

Firefox, a cross platform browser, only lists voices installed locally on the system.

It does not support "online" voices natively. The top hit for a "voice" search of Firefox addons was one called "Read Aloud", whose blurb shows support for cloud voices. However this is not a solution for developers as it requires users to update their machines. (Disclaimer: this is a search result: I have not investigated "Read Aloud" or other results further.)

Edge lists "Microsoft Online" voices as well as installed voices.

Google Chrome lists online voices too - but only those from Google, not the Microsoft ones (the last time I tried it).

I think the Canadian description for Chrome and Edge behaviour is "elbows up", while Firefox doesn't play hockey.

发布评论

评论列表(0)

  1. 暂无评论