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.83k stars 154 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 3 years ago

In Readium2_desktop_testapp, I get the following:

This app has not been updated for some time ... definitely an older Electron / Chrome version.

danielweck commented 3 years ago

This is what my Windows 10 virtual machine shows:

Screenshot 2021-04-10 at 22 57 42 Screenshot 2021-04-10 at 22 56 36
danielweck commented 3 years ago

So, could you please go to your Windows settings and make sure you have a few standard voices installed (i.e. not "proprietary" voice packages installed with API access keys ... which may only be available through licensed apps, if I am not mistaken)

PhilippeBruno commented 3 years ago

image

danielweck commented 3 years ago

Could you please try installing the French/France voice (I have "Microsoft Hortense Desktop", according to my screenshot). Perhaps the fr-CA TTS voice uses a different API (maybe not SAPI5).

PhilippeBruno commented 3 years ago

Daniel! I installed French (France) and I now have 1 additional French voice in Thorium!

image

PhilippeBruno commented 3 years ago

I will uninstall French (Canada) and reinstall it.

danielweck commented 3 years ago

Daniel! I installed French (France) and I now have 1 additional French voice in Thorium!

Good to know :)

I am aware of Registry tricks to activate voices that are normally not exposed by default ... but I haven't tried myself, and modifying the Windows registry is obviously not without risks:

https://stackoverflow.com/questions/47379725/how-do-i-add-a-voice-language-to-speechsynthesis

ways2read commented 3 years ago

FWIW, I have several OneCore voices installed on my PC (English UK, English US x2, Italian, Russian, Italian, French). If I do not touch anything, then the language switching in read aloud works fine.

Now these voices are available to me in the Thorium UI, and if select a voice, then this is the voice that is used. This way, I can choose which English voice to be used. However, the language switching is lost.

If I change the setting back to 'Text to Speech voice' then the language switching works again.

If that is the designed behaviour, then text 'Text to Speech voice' might be better changed to 'Default voices' or something like that.

ways2read commented 3 years ago

To be more clear, I think this latest implementation is a good approach. Some users may wish their settings to persist, but I understand that is this a cautious approach, and if people want this then they will ask for it! Thanks @danielweck and team for another enhancement to this awesome app!

PhilippeBruno commented 3 years ago

I tried removing French (Canada) but the "Remove" button is greyed out... I rebooted and tried many things, but it seems somehow it is tied to other settings such as keyboard and display, so I do not feel like uninstalling all that... At least I now have "Hortense" who can read in French in Thorium... I'll get to know her... ;)

PhilippeBruno commented 3 years ago

Ok, I tried on a virtual Windows 10 Pro machine with a default US English setting and Thorium v1.6.1-alpha.1.736604465. Thorium shows the following voices available:

Microsoft David Desktop - English (United States) (en-US) Microsoft Zira Desktop - English (United States) (en-US)

even though Windows Settings show

Microsoft David Microsoft Zira Microsoft Mark

I then installed the French (Canada) package. This added the following two voices to Windows Settings:

Microsoft Caroline Microsoft Claude

However, Thorium continues to ignore the newly added French Canadian voices (maybe an heritage from the famous battle of Wolf vs Montcalm - just kidding).

When adding French (France), I get one additional voice in Thorium:

Microsoft Hortense

Ok, it is not perfect, but much better. There is still a peculiarity with the way Chromium handles voices on Windows, but for now, we'll get to know "cousin" Hortense (as Canadians amicably call the French and vice-versa).

PhilippeBruno commented 3 years ago

@danielweck I just saw your registry trick... I'll try it on my virtual machine and let you know how it goes.

PhilippeBruno commented 3 years ago

@danielweck You are a genius! The registry hack worked like a charm! Look at all the choices I have in Thorium now! This is so great! Thank you, thank you, thank you! Merci beaucoup mon ami! You deserve a nice beer for that!

image

danielweck commented 3 years ago

Thanks for daring to try :) I am glad to hear that this trick works. Obviously, credit to the folks who figured this out in the first place, not me ;)

danielweck commented 3 years ago

I understand that is this a cautious approach, and if people want this then they will ask for it!

Hi Richard! Yes, that's the idea. This is just a starting point.

Perhaps simple "save" and "reset" commands would meet the users needs nicely, but I am concerned that the top toolbar is getting too crowded. There are already "save" and "reset" buttons for the application's general user preferences, these are located in the main reader menu. The more fine-grained the level of customization is, the more confusing the UI can become. So unless there is a strong demand to make the TTS playback rate and voice selectors persistent across reading sessions, I think we should stick to a simple UI formula.

danielweck commented 3 years ago

If that is the designed behaviour, then text 'Text to Speech voice' might be better changed to 'Default voices' or something like that.

That is indeed the implemented behaviour. The TTS voice selector always shows the "no user selection / no override" at the top of the list (you are right, we need a better label). Below that first choice, there is an series of available system voices, ordered by language tag. Somewhere in that list is a default voice (as defined by the operating system, not Thorium), denoted by a * character at the end of the TTS voice label.

danielweck commented 3 years ago

I improved the voice selector control by sectioning the ordered list based on language. What do you think?

Screenshot 2021-04-11 at 08 41 00

ways2read commented 3 years ago

I think you have lots of voices installed! Looks good! I wonder why Kate has an asterisk?

Richard


From: Daniel Weck @.> Sent: Sunday, April 11, 2021 8:42:31 AM To: edrlab/thorium-reader @.> Cc: Richard Orme @.>; Mention @.> Subject: Re: [edrlab/thorium-reader] Text to Speech language-voice selection (mapping?) + user preference/override (#1130)

I improved the voice selector control by sectioning the ordered list based on language. What do you think?

[Screenshot 2021-04-11 at 08 41 00]https://user-images.githubusercontent.com/625201/114296189-c4f90b80-9aa1-11eb-88b6-6d4058b99ebe.png

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

danielweck commented 3 years ago

I wonder why Kate has an asterisk?

This is the default voice as defined by the operating system (not Thorium)

PhilippeBruno commented 3 years ago

I thought Kate was Daniel's favourite... ;)

The grouped-by language display of the various voices is an interesting idea, but I am not sure I necessarily prefer that over the original order. For one, at least in Windows, the original order is the one we see throughout Windows and other apps. I have not tried it, but I assume this group-by presentation inserts "non clickable" items in the list (the language separators), which may add confusion. Keep in mind that not everybody will actually have as many installed languages as this. I will install the latest version and give it a try.

PhilippeBruno commented 3 years ago

Thanks for daring to try :) I am glad to hear that this trick works.

I tried on a virtual machine I setup for that purpose; not exactly what I call very daring... ;)

Bottom line, however, is that by finally displaying the languages, we were able together to solve a peculiar issue that had been preventing the read-out-loud function to work properly, at least on Windows machines. EPUB that must have been properly identified as a certain language other than English were in fact read in English simply because Windows did not expose those languages to the Chromium engine. The registry trick certainly fixed the problem, but without knowing that Thorium only had access to a subset of the installed languages, we thought the problem lied in poorly tagged EPUB (language-wise) or in some sort of improper language identification by Thorium. So I am really glad you guys managed to implement that drop-down list of languages.

PhilippeBruno commented 3 years ago

Oh, and one last thing, I think that being able to select our desired voice rather than defaulting to the system voice is great too. Not all voices are equally good, and it is really nice to have the possibility to select which one we want. Thumbs up!

danielweck commented 3 years ago

I assume this group-by presentation inserts "non clickable" items in the list (the language separators), which may add confusion.

Clicking a language heading selects the first voice available in that locale.

danielweck commented 3 years ago

Keep in mind that not everybody will actually have as many installed languages as this.

I have just realised that MacOS exposes its available TTS voices using a similar UI paradigm (albeit a but better / more sophisticated implementation ... by contrast, Thorium uses the default / native HTML <select> + <option> UI control :)

Screenshot 2021-04-11 at 21 56 14

PhilippeBruno commented 3 years ago

This is definitely better than Windows' UI. I understand where you are coming from. Then, I support your idea.

dolevu commented 3 years ago

Is there anyway to set a default voice on Thorium? I don't mind changing the voice manually if it doesn't work well for the current epub file.

The problem is even if I set the Windows default voice to Zira or Eva, the "system default" option on Thorium still uses David's voice.

danielweck commented 3 years ago

Is there anyway to set a default voice on Thorium? I don't mind changing the voice manually if it doesn't work well for the current epub file.

The problem is even if I set the Windows default voice to Zira or Eva, the "system default" option on Thorium still uses David's voice.

See: https://github.com/edrlab/thorium-reader/issues/1542

danielweck commented 2 years ago

Related issue https://github.com/edrlab/thorium-reader/issues/1648#issuecomment-1057845920