edrlab / thorium-reader

A cross platform desktop reading app, based on the Readium Desktop toolkit
https://www.edrlab.org/software/thorium-reader/
BSD 3-Clause "New" or "Revised" License
1.75k stars 152 forks source link

Text to Speech language-voice selection (mapping?) + user preference/override #1130

Closed PhilippeBruno closed 3 years ago

PhilippeBruno commented 4 years ago

I just tried the Text to Speech feature... Interesting, but how is one supposed to change the spoken language? So far, the Text to Speech feature is totally unusable with the French EPUBs I have...

danielweck commented 4 years ago

The language used by the TTS engine during playback is picked-up dynamically from the lang attributes present in the publication's HTML markup (note that mixed-languages documents are supported).

Can you please check your publication documents?

PhilippeBruno commented 4 years ago

None of the French EPUBs I tried are read in French. It definitely does not sound like a French utterer... I mean, I get the gist of it, but I would not listen to this for more than 2 minutes as every word is pronounced with the English accent.

I double checked both the book info panel as well as inside the content.opf to make sure and they are all flagged as French EPUBs.

danielweck commented 4 years ago

The OPF package metadata declares the publication's primary language as well as any secondary languages included in the EPUB.

TTS playback relies on the language declared in individual HTML documents, at the markup level (e.g. body, p or div etc. elements, with xml:lang attributes)

PhilippeBruno commented 4 years ago

Well, I just tested even more French books, both French (fr) and French (fr-CA), to no avail. I have no control over the individual HTML document inside and EBUB if they are not properly labelled!

danielweck commented 4 years ago

Could you please unzip a FR publication to open an HTML chapter with your text editor? Can you see any language attributes? (usually at least on the root html element, otherwise body)

PhilippeBruno commented 4 years ago

Ok, I checked about a dozen books. They are all French from France of from Canada. All are flagged as either

<body xml:lang="fr-FR">

or

<body xml:lang="fr-CA">

(some also had the xml:lang attribute in a div or root html elements) inside the HTML chapters, but none of them are read in French. I also tested a Spanish EPUB and an Italian EPUB with the same results.

PhilippeBruno commented 4 years ago

Could this be machine related? Could this be due to the fact I am using Thorium v1.3.1-alpha.1.138?

danielweck commented 4 years ago

Great, thank you for helping troubleshoot this. Would you mind privately sharing one of these EPUBs with me so I can check at my end?

PhilippeBruno commented 4 years ago

No problem. Just tell me how to send it to you.

danielweck commented 4 years ago

daniel.weck@gmail.com Thank you :)

PhilippeBruno commented 4 years ago

Sent!

PhilippeBruno commented 4 years ago

@danielweck Any luck investigating the Text to Speech issue?

danielweck commented 4 years ago

Thank you for sharing the 3 EPUBs. The TTS rendition is correct in MacOS (French, male or female voice ... depending on the "mood" of the underlying system-level TTS engine, it seems). I do not have time to test in Windows at the moment, but will need to check.

PhilippeBruno commented 4 years ago

Great. Let me know if I can be of further assistance.

danielweck commented 4 years ago

I am able to reproduce this bug in Windows, thank you for reporting!

I launched an automated build of r2-testapp-js (same underlying functionality as Thorium / Readium Desktop SDK) from my VirtualBox Windows 10 VM, and I loaded one of your EPUBs ... the language picked-up in the DOM and given to the system-level TTS engine seems to be ignored (defaults to English).

This could be a bug in the Electron/Chromium interface. This is strange because I have seen working demos of multilingual EPUBs on Windows. Maybe there has been a breaking change either in Windows SAPI (TTS component) or in Electron/Chromium, since then.

PhilippeBruno commented 4 years ago

No problem. I'll keep putting the app to the test, so if I experience other problems, I'll continue to report them! And if I can contribute to the project in a more meaningful way, do not hesitate to ask.

danielweck commented 4 years ago

And if I can contribute to the project in a more meaningful way, do not hesitate to ask.

We (the dev team) really appreciate when users test Thorium "in the field". These contributions are meaningful ;) But I see what you mean, so thank you very much for offering.

ways2read commented 4 years ago

Confirming that language switching in 'Au dessou du volcano' is working OK with fr, de, en and es in 1.4.1-alpha.1.182452881 on Windows 10.

danielweck commented 4 years ago

Really??! Well I am confused. I wonder whether there has been a recent change in Windows SAPI, perhaps related to the latest major Windows Update? Because I am able to reproduce the "bug" 100% of the time, i.e. on MacOS the TTS reads aloud using the correct language (which is picked-up at the level of each indidivual utterances, not just at the top document level), but in my Windows the TTS engine uses the English voice to read French, German, Greek, etc.

danielweck commented 4 years ago

@ways2read would you mind privately sharing a multilingual EPUB, or several single-language EPUBs, so I can compare the outcome of my Windows test with yours?

ways2read commented 4 years ago

http://somup.com/cYiu2B6I80

(I know some of the language is marked wrong, it is set up for a tutorial)

From: Daniel Weck notifications@github.com Sent: 28 July 2020 15:33 To: edrlab/thorium-reader thorium-reader@noreply.github.com Cc: Richard Orme rorme@daisy.org; Comment comment@noreply.github.com Subject: Re: [edrlab/thorium-reader] Text to Speech language (#1130)

Really??! Well I am confused. I wonder whether there has been a recent change in Windows SAPI, perhaps related to the latest major Windows Update? Because I am able to reproduce the "bug" 100% of the time, i.e. on MacOS the TTS reads aloud using the correct language (which is picked-up at the level of each indidivual utterances, not just at the top document level), but in my Windows the TTS engine uses the English voice to read French, German, Greek, etc.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/edrlab/thorium-reader/issues/1130#issuecomment-665076627, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACFL56Z7NVA3YYJABFQG4BTR53OS7ANCNFSM4O6UZHDQ.

danielweck commented 4 years ago

This is great Richard, thank you so much for recording your test. Could you please send me this EPUB, and I will test it now.

danielweck commented 4 years ago

Thank you Richard for sharing the EPUB. I can confirm that the TTS engine attempts to speak the French text, using an English voice. I am going to check my language packs settings in Windows 10...

danielweck commented 4 years ago

Phew, I am reassured, I simply added the missing TTS voices in the Windows "speech" configuration panel, and the multilingual EPUBs are now narrated using the correct utterance locale. Single-language non-English EPUBs now also play correctly.

So, @PhilippeBruno would you mind checking your "speech" settings, and make sure you have the necessary language packs?

PhilippeBruno commented 4 years ago

@danielweck Interesting... I have French (Canada) TTS installed... but not French (France)... I wonder if this could be the problem. Let me add French (France) and see...

PhilippeBruno commented 4 years ago

Bingo! All is good now... Except I have to live with the French (France) accent, which is different from the French (Canada) accent... probably comparable to British vs US accent. I do understand everything being read, it's just not the way we speak.

PhilippeBruno commented 4 years ago

Well, I do not think this particular problem is "Thorium" related though... unless I am mistaken. Very often, EPUBs are tagged as French (France), so I guess the Microsoft TTS engine is expecting to find a corresponding TTS. Anybody can confirm that hypothesis? Do you experience the same problem with UK/US EPUBs?

danielweck commented 4 years ago

Thorium passes the locale declared in the HTML markup (e.g. <p xml:lang=“fr-CA”>Bonjour<p>) as-is to the underlying TTS engine, simply by configuring the utterance with the authored language (e.g. fr-CA).

So, if indeed your EPUBs are authored with fr-FR instead of fr-CA, then I am afraid the selected voice will match the specified locale.

If however fr is the authored language attribute, then I would assume that the Windows default / preferred locale is used. For example on my Windows VM this is en-UK, not en-US.

danielweck commented 4 years ago

I double-checked the code, and I can confirm that the full locale is preserved (e.g. fr-FR instead of the less precise fr language code).

const utterance = new SpeechSynthesisUtterance(“Bonjour”);
utterance.lang = “fr-FR”;
// etc.

I can also confirm that the code reads xml:lang, and if missing, then reads the lang attribute.

PhilippeBruno commented 4 years ago

@danielweck I will investigate a bit more... Perhaps my machine settings are not conventional in the sense that I actually work in a bilingual French/English environment with North American French and English keyboards, TTS and handwritten recognition in both languages as well (I am on a Microsoft Surface). I know Windows does get confused sometimes and thinks I handwrite in English when I am handwriting in French and does all sorts of bizarre things with TTS and keyboards that require me to reboot.

Quick question for you @danielweck ...Would it be possible to add an option to override the picked up language on the fly if, for some reason, the user is not content with the output? For example, one is listening to a French Canadian novel with lots of French Canadian expressions and one might feel uncomfortable if Thorium is reading out loud with a Parisian French accent. In that situation, one would simply override the detected parameters and manually select the appropriate voice.

danielweck commented 4 years ago

Hello, I renamed this issue in order to keep it open, as I think the contents of the discussion thread can help inform the UX design for language-voice mapping and user preferences (overrides).

momoha2 commented 3 years ago

Hello @danielweck

I’m also French Canadian, but I actually produce ePubs, so I could test the issue a bit more further. The locale doesn’t seem to be followed by Thorium. I installed both the France and Canadian french voice packs on my Windows, then made sure my file was tagged with xml:lang="fr-CA", both in the and , and Thorium still reads using the french voice instead of the canadian one.

It would be amazing if you can solve this issue!

danielweck commented 3 years ago

Fixed via https://github.com/edrlab/thorium-reader/commit/ba01cb6bd74b2dadf37667bc1eb27c30f4cb13d1 (and https://github.com/readium/r2-navigator-js/commit/946265d4adb91126cd2937205453a756cb5b9962 in the r2-navigato-js component)

This new UI feature displays available synthetic voices (e.g. on Windows, exposed by the SAPI5 interface that Chromium's Web Speech API delegates to), via a pull-down selector located immediately next to the speech rate selector (which is displayed when the play button is clicked, at the centre of the top toolbar).

By default, no voice is selected by the user, and the TTS engine automatically selects an appropriate voice during playback, based on the utterance language authored in the source HTML markup (either as a lang / xml:lang attribute on the HTML root element, or anywhere in the body). When the user selects a TTS voice, this is effectively a system override, and the synthetic speech engine will attempt to speak the text using the selected voice regardless of language compatibility.

Just like the TTS rate selector, this is a transient user preference that survives inside a reading session for a given reader window, but is reset to the defaults values for each new reader window. This is currently considered the safer UX pattern given the inconsistencies between loaded publications, such as authored language (if any), actual language (e.g. French Canadian vs. France), text verbosity, etc.

We can expect user feedback about this baseline feature as implemented right now, and we will iterate / tweak if necessary. At least, and at last, Thorium now offers a way to pick a voice from the system's synthetic speech options, in order to override the default in situations that require it (which was our most common negative feedback from users).

PhilippeBruno commented 3 years ago

Hurray! This is some great news! Thanks to the team for finally incorporating this feature!

danielweck commented 3 years ago

You are welcome. You will see that the list of synthetic speech voices can be quite long in the pull-down selector control. I sorted the voices by their language code, so that various fr voices are located near each other (e.g. CA and FR). I am sure that we can improve the UI, and therefore the UX (e.g. quickly select a favourite voice, filter by language, etc.) But I wanted to deliver a reliable baseline with solid mechanics, before design iterations. I explored ways to allow advanced users to select favourite voices per language, but the UI would get very complicated, and really benefit only a few users who deal with multilingual publications and wish to have fine-grain control. Plus, I think this is better configured at the system level. This Thorium feature is really more a workaround for badly-authored publications where the markup does not contains the correct language code. Do not hesitate to continue the discussion thread here, we receive notifications even for closed issues :)

PhilippeBruno commented 3 years ago

Daniel, it does not work! I opened French EPUBs, both French Canada and French France, and Thorium only displays English voices!

image

And I know I have more voices installed... For example, see a screenshot from "Any Text to Voice" from AnywaySoft:

image

This is from my Windows Speech settings:

Untitled
danielweck commented 3 years ago

That's a shame :(

The getVoices() method of the SpeechSynthesis interface returns a list of SpeechSynthesisVoice objects representing all the available voices on the current device.

https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis/getVoices

danielweck commented 3 years ago

Could you please test this Javscript code in your web browser(s):

window.speechSynthesis.getVoices().forEach((v, i) => console.log(`${i}: ${v.name} ${v.lang} ${v.default} ${v.localService} ${v.voiceURI}`))

(just enter this in the "web inspector" console and press enter)

I see this in Firefox on MacOS:

0: Alex en-US false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.Alex
1: Alice it-IT false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.alice
2: Alva sv-SE false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.alva
3: Amelie fr-CA false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.amelie.premium
4: Anna de-DE false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.anna
5: Carmit he-IL false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.carmit
6: Damayanti id-ID false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.damayanti
7: Daniel en-GB false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.daniel.premium
8: Diego es-AR false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.diego
9: Ellen nl-BE false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.ellen
10: Fiona en-scotland false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.fiona.premium
11: Fred en-US false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.Fred
12: Ioana ro-RO false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.ioana
13: Joana pt-PT false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.joana
14: Jorge es-ES false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.jorge
15: Juan es-MX false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.juan
16: Kanya th-TH false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.kanya
17: Karen en-AU false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.karen
18: Kate en-GB true true urn:moz-tts:osx:com.apple.speech.synthesis.voice.kate.premium
19: Kyoko ja-JP false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.kyoko
20: Laura sk-SK false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.laura
21: Lekha hi-IN false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.lekha
22: Luca it-IT false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.luca
23: Luciana pt-BR false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.luciana
24: Maged ar-SA false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.maged
25: Mariska hu-HU false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.mariska
26: Mei-Jia zh-TW false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.mei-jia
27: Melina el-GR false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.melina
28: Milena ru-RU false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.milena
29: Moira en-IE false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.moira
30: Monica es-ES false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.monica
31: Nora nb-NO false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.nora
32: Oliver en-GB false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.oliver.premium
33: Paulina es-MX false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.paulina
34: Rishi en-IN false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.rishi
35: Samantha en-US false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.samantha
36: Sara da-DK false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.sara
37: Satu fi-FI false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.satu
38: Serena en-GB false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.serena.premium
39: Sin-ji zh-HK false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.sin-ji
40: Tessa en-ZA false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.tessa
41: Thomas fr-FR false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.thomas.premium
42: Ting-Ting zh-CN false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.ting-ting
43: Veena en-IN false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.veena
44: Victoria en-US false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.Victoria
45: Xander nl-NL false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.xander
46: Yelda tr-TR false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.yelda
47: Yuna ko-KR false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.yuna
48: Yuri ru-RU false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.yuri
49: Zosia pl-PL false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.zosia
50: Zuzana cs-CZ false true urn:moz-tts:osx:com.apple.speech.synthesis.voice.zuzana
danielweck commented 3 years ago

I see this in Chrome (MacOS):

0: Kate en-GB true true Kate
1: Alex en-US false true Alex
2: Alice it-IT false true Alice
3: Alva sv-SE false true Alva
4: Amelie fr-CA false true Amelie
5: Anna de-DE false true Anna
6: Carmit he-IL false true Carmit
7: Damayanti id-ID false true Damayanti
8: Daniel en-GB false true Daniel
9: Diego es-AR false true Diego
10: Ellen nl-BE false true Ellen
11: Fiona en false true Fiona
12: Fred en-US false true Fred
13: Ioana ro-RO false true Ioana
14: Joana pt-PT false true Joana
15: Jorge es-ES false true Jorge
16: Juan es-MX false true Juan
17: Kanya th-TH false true Kanya
18: Karen en-AU false true Karen
19: Kyoko ja-JP false true Kyoko
20: Laura sk-SK false true Laura
21: Lekha hi-IN false true Lekha
22: Luca it-IT false true Luca
23: Luciana pt-BR false true Luciana
24: Maged ar-SA false true Maged
25: Mariska hu-HU false true Mariska
26: Mei-Jia zh-TW false true Mei-Jia
27: Melina el-GR false true Melina
28: Milena ru-RU false true Milena
29: Moira en-IE false true Moira
30: Monica es-ES false true Monica
31: Nora nb-NO false true Nora
32: Oliver en-GB false true Oliver
33: Paulina es-MX false true Paulina
34: Rishi en-IN false true Rishi
35: Samantha en-US false true Samantha
36: Sara da-DK false true Sara
37: Satu fi-FI false true Satu
38: Serena en-GB false true Serena
39: Sin-ji zh-HK false true Sin-ji
40: Tessa en-ZA false true Tessa
41: Thomas fr-FR false true Thomas
42: Ting-Ting zh-CN false true Ting-Ting
43: Veena en-IN false true Veena
44: Victoria en-US false true Victoria
45: Xander nl-NL false true Xander
46: Yelda tr-TR false true Yelda
47: Yuna ko-KR false true Yuna
48: Yuri ru-RU false true Yuri
49: Zosia pl-PL false true Zosia
50: Zuzana cs-CZ false true Zuzana
51: Google Deutsch de-DE false false Google Deutsch
52: Google US English en-US false false Google US English
53: Google UK English Female en-GB false false Google UK English Female
54: Google UK English Male en-GB false false Google UK English Male
55: Google español es-ES false false Google español
56: Google español de Estados Unidos es-US false false Google español de Estados Unidos
57: Google français fr-FR false false Google français
58: Google हिन्दी hi-IN false false Google हिन्दी
59: Google Bahasa Indonesia id-ID false false Google Bahasa Indonesia
60: Google italiano it-IT false false Google italiano
61: Google 日本語 ja-JP false false Google 日本語
62: Google 한국의 ko-KR false false Google 한국의
63: Google Nederlands nl-NL false false Google Nederlands
64: Google polski pl-PL false false Google polski
65: Google português do Brasil pt-BR false false Google português do Brasil
66: Google русский ru-RU false false Google русский
67: Google 普通话(中国大陆) zh-CN false false Google 普通话(中国大陆)
68: Google 粤語(香港) zh-HK false false Google 粤語(香港)
69: Google 國語(臺灣) zh-TW false false Google 國語(臺灣)
danielweck commented 3 years ago

I see this in Safari MacOS:

0: Alex en-US false true com.apple.speech.synthesis.voice.Alex
1: Alice it-IT false true com.apple.speech.synthesis.voice.alice
2: Alva sv-SE false true com.apple.speech.synthesis.voice.alva
3: Amelie fr-CA false true com.apple.speech.synthesis.voice.amelie
4: Amelie fr-CA true true com.apple.speech.synthesis.voice.amelie.premium
5: Anna de-DE false true com.apple.speech.synthesis.voice.anna
6: Carmit he-IL false true com.apple.speech.synthesis.voice.carmit
7: Damayanti id-ID false true com.apple.speech.synthesis.voice.damayanti
8: Daniel en-GB true true com.apple.speech.synthesis.voice.daniel.premium
9: Daniel en-GB false true com.apple.speech.synthesis.voice.daniel
10: Diego es-AR false true com.apple.speech.synthesis.voice.diego
11: Ellen nl-BE false true com.apple.speech.synthesis.voice.ellen
12: Fiona en-scotland false true com.apple.speech.synthesis.voice.fiona
13: Fiona en-scotland true true com.apple.speech.synthesis.voice.fiona.premium
14: Fred en-US false true com.apple.speech.synthesis.voice.Fred
15: Ioana ro-RO false true com.apple.speech.synthesis.voice.ioana
16: Joana pt-PT false true com.apple.speech.synthesis.voice.joana
17: Jorge es-ES false true com.apple.speech.synthesis.voice.jorge
18: Juan es-MX false true com.apple.speech.synthesis.voice.juan
19: Kanya th-TH false true com.apple.speech.synthesis.voice.kanya
20: Karen en-AU false true com.apple.speech.synthesis.voice.karen
21: Kate en-GB false true com.apple.speech.synthesis.voice.kate
22: Kate en-GB false true com.apple.speech.synthesis.voice.kate.premium
23: Kyoko ja-JP false true com.apple.speech.synthesis.voice.kyoko
24: Laura sk-SK false true com.apple.speech.synthesis.voice.laura
25: Lekha hi-IN false true com.apple.speech.synthesis.voice.lekha
26: Luca it-IT false true com.apple.speech.synthesis.voice.luca
27: Luciana pt-BR false true com.apple.speech.synthesis.voice.luciana
28: Maged ar-SA false true com.apple.speech.synthesis.voice.maged
29: Mariska hu-HU false true com.apple.speech.synthesis.voice.mariska
30: Mei-Jia zh-TW false true com.apple.speech.synthesis.voice.mei-jia
31: Melina el-GR false true com.apple.speech.synthesis.voice.melina
32: Milena ru-RU false true com.apple.speech.synthesis.voice.milena
33: Moira en-IE false true com.apple.speech.synthesis.voice.moira
34: Monica es-ES false true com.apple.speech.synthesis.voice.monica
35: Nora nb-NO false true com.apple.speech.synthesis.voice.nora
36: Oliver en-GB false true com.apple.speech.synthesis.voice.oliver.premium
37: Oliver en-GB false true com.apple.speech.synthesis.voice.oliver
38: Paulina es-MX false true com.apple.speech.synthesis.voice.paulina
39: Rishi en-IN false true com.apple.speech.synthesis.voice.rishi
40: Samantha en-US false true com.apple.speech.synthesis.voice.samantha
41: Sara da-DK false true com.apple.speech.synthesis.voice.sara
42: Satu fi-FI false true com.apple.speech.synthesis.voice.satu
43: Serena en-GB false true com.apple.speech.synthesis.voice.serena
44: Serena en-GB false true com.apple.speech.synthesis.voice.serena.premium
45: Sin-ji zh-HK false true com.apple.speech.synthesis.voice.sin-ji
46: Tessa en-ZA false true com.apple.speech.synthesis.voice.tessa
47: Thomas fr-FR false true com.apple.speech.synthesis.voice.thomas
48: Thomas fr-FR true true com.apple.speech.synthesis.voice.thomas.premium
49: Ting-Ting zh-CN false true com.apple.speech.synthesis.voice.ting-ting
50: Veena en-IN false true com.apple.speech.synthesis.voice.veena
51: Victoria en-US false true com.apple.speech.synthesis.voice.Victoria
52: Xander nl-NL false true com.apple.speech.synthesis.voice.xander
53: Yelda tr-TR false true com.apple.speech.synthesis.voice.yelda
54: Yuna ko-KR false true com.apple.speech.synthesis.voice.yuna
55: Yuri ru-RU false true com.apple.speech.synthesis.voice.yuri
56: Zosia pl-PL false true com.apple.speech.synthesis.voice.zosia
57: Zuzana cs-CZ false true com.apple.speech.synthesis.voice.zuzana
PhilippeBruno commented 3 years ago

Here is what I get in my Edge browser:

0: Microsoft David - English (United States) en-US true true Microsoft David - English (United States)
1: Microsoft Mark - English (United States) en-US false true Microsoft Mark - English (United States)
2: Microsoft Zira - English (United States) en-US false true Microsoft Zira - English (United States)
3: Microsoft Caroline - French (Canada) fr-CA false true Microsoft Caroline - French (Canada)
4: Microsoft Claude - French (Canada) fr-CA false true Microsoft Claude - French (Canada)
5: Microsoft Nathalie - French (Canada) fr-CA false true Microsoft Nathalie - French (Canada)
6: Microsoft Katja Online (Natural) - German (Germany) de-DE false false Microsoft Katja Online (Natural) - German (Germany)
7: Microsoft Natasha Online (Natural) - English (Australia) en-AU false false Microsoft Natasha Online (Natural) - English (Australia)
8: Microsoft Clara Online (Natural) - English (Canada) en-CA false false Microsoft Clara Online (Natural) - English (Canada)
9: Microsoft Mia Online (Natural) - English (United Kingdom) en-GB false false Microsoft Mia Online (Natural) - English (United Kingdom)
10: Microsoft Neerja Online (Natural) - English (India) en-IN false false Microsoft Neerja Online (Natural) - English (India)
11: Microsoft Aria Online (Natural) - English (United States) en-US false false Microsoft Aria Online (Natural) - English (United States)
12: Microsoft Guy Online (Natural) - English (United States) en-US false false Microsoft Guy Online (Natural) - English (United States)
13: Microsoft Elvira Online (Natural) - Spanish (Spain) es-ES false false Microsoft Elvira Online (Natural) - Spanish (Spain)
14: Microsoft Dalia Online (Natural) - Spanish (Mexico) es-MX false false Microsoft Dalia Online (Natural) - Spanish (Mexico)
15: Microsoft Sylvie Online (Natural) - French (Canada) fr-CA false false Microsoft Sylvie Online (Natural) - French (Canada)
16: Microsoft Denise Online (Natural) - French (France) fr-FR false false Microsoft Denise Online (Natural) - French (France)
17: Microsoft Swara Online (Natural) - Hindi (India) hi-IN false false Microsoft Swara Online (Natural) - Hindi (India)
18: Microsoft Elsa Online (Natural) - Italian (Italy) it-IT false false Microsoft Elsa Online (Natural) - Italian (Italy)
19: Microsoft Nanami Online (Natural) - Japanese (Japan) ja-JP false false Microsoft Nanami Online (Natural) - Japanese (Japan)
20: Microsoft SunHi Online (Natural) - Korean (Korea) ko-KR false false Microsoft SunHi Online (Natural) - Korean (Korea)
21: Microsoft Colette Online (Natural) - Dutch (Netherlands) nl-NL false false Microsoft Colette Online (Natural) - Dutch (Netherlands)
22: Microsoft Zofia Online (Natural) - Polish (Poland) pl-PL false false Microsoft Zofia Online (Natural) - Polish (Poland)
23: Microsoft Francisca Online (Natural) - Portuguese (Brazil) pt-BR false false Microsoft Francisca Online (Natural) - Portuguese (Brazil)
24: Microsoft Dariya Online (Natural) - Russian (Russia) ru-RU false false Microsoft Dariya Online (Natural) - Russian (Russia)
25: Microsoft Emel Online (Natural) - Turkish (Turkey) tr-TR false false Microsoft Emel Online (Natural) - Turkish (Turkey)
26: Microsoft Xiaoxiao Online (Natural) - Chinese (Mainland) zh-CN false false Microsoft Xiaoxiao Online (Natural) - Chinese (Mainland)
27: Microsoft Yunyang Online (Natural) - Chinese (Mainland) zh-CN false false Microsoft Yunyang Online (Natural) - Chinese (Mainland)
28: Microsoft HiuGaai Online (Natural) - Chinese (Hong Kong) zh-HK false false Microsoft HiuGaai Online (Natural) - Chinese (Hong Kong)
29: Microsoft HsiaoYu Online (Natural) - Chinese (Taiwan) zh-TW false false Microsoft HsiaoYu Online (Natural) - Chinese (Taiwan)
danielweck commented 3 years ago

Would you mind trying Chrome, please?

PhilippeBruno commented 3 years ago

Meanwhile, I was doing some tests and research with simple JavaScript in my Edge browser and there seems to be a problem with the way Chromium loads available voices... The following message on StackOverflow gave me a hint:

This happens because SpeechSynthesis API allows the usage of remote servers for speech synthesis and Chrome requests a list of voices from Google's servers. To fix this you need to wait when voices will be loaded and then request them again.

To do so you should to listen a voicechanged event, and then initialise your program's logic:

speechSynthesis.addEventListener("voiceschanged", () => {
  const voices = speechSynthesis.getVoices()
})
PhilippeBruno commented 3 years ago

With Chrome, on the first attempt, I get

undefined

However, after trying a second time, I get

0: Microsoft David Desktop - English (United States) en-US true true Microsoft David Desktop - English (United States)
1: Microsoft Zira Desktop - English (United States) en-US false true Microsoft Zira Desktop - English (United States)
2: Google Deutsch de-DE false false Google Deutsch
3: Google US English en-US false false Google US English
4: Google UK English Female en-GB false false Google UK English Female
5: Google UK English Male en-GB false false Google UK English Male
6: Google español es-ES false false Google español
7: Google español de Estados Unidos es-US false false Google español de Estados Unidos
8: Google français fr-FR false false Google français
9: Google हिन्दी hi-IN false false Google हिन्दी
10: Google Bahasa Indonesia id-ID false false Google Bahasa Indonesia
11: Google italiano it-IT false false Google italiano
12: Google 日本語 ja-JP false false Google 日本語
13: Google 한국의 ko-KR false false Google 한국의
14: Google Nederlands nl-NL false false Google Nederlands
15: Google polski pl-PL false false Google polski
16: Google português do Brasil pt-BR false false Google português do Brasil
17: Google русский ru-RU false false Google русский
18: Google 普通话(中国大陆) zh-CN false false Google 普通话(中国大陆)
19: Google 粤語(香港) zh-HK false false Google 粤語(香港)
20: Google 國語(臺灣) zh-TW false false Google 國語(臺灣)
danielweck commented 3 years ago

Yes, that makes total sense (unfortunately). The "Google"-prefixed voices are not exposed in the Web Speech API, so all that's left is the first two "Microsoft" voices!

PhilippeBruno commented 3 years ago

How do you explain why Edge sees more "Microsoft" voices than Chrome, especially those available locally?

danielweck commented 3 years ago

Note: Thorium is built with Electron which ships with a different / older version of the Chromium web browser engine compared with Google's most current Chrome web browser. Thorium currently uses Electron v11 (not quite the latest stable available version, which is v12). You can try the aforementioned console command with Electron Fiddle (use the "toggle developer tools" from the menu to access the "web inspector" and its console). https://www.electronjs.org/fiddle

danielweck commented 3 years ago

How do you explain why Edge sees more "Microsoft" voices than Chrome, especially those available locally?

Although Edge is built on Chromium, it is a Microsoft product so I assume they integrate much more closely with their system / OS-level APIs.

PhilippeBruno commented 3 years ago

In Readium2_desktop_testapp, I get the following:

0: Microsoft David Desktop - English (United States) en-US true true Microsoft David Desktop - English (United States)
1: Microsoft Zira Desktop - English (United States) en-US false true Microsoft Zira Desktop - English (United States)
PhilippeBruno commented 3 years ago

Although Edge is built on Chromium, it is a Microsoft product so I assume they integrate much more closely with their system / OS-level APIs.

Makes sense.