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.86k stars 158 forks source link

Choose default text to speech voice in Thorium #1542

Closed dolevu closed 2 years ago

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

Hello, thank you for reporting this "bug" ... unfortunately I am unable to reproduce it :) I am on MacOS, I use the "System Preferences" Accessibility -> Speech panel to change the "System Voice", and Thorium correctly reflects this when choosing the first "Voice: system default" option in the pull-down selector list. Additionally, this default voice is marked with a star / asterisk next to its label in the list. Note that the reader window must be closed and re-opened for the system change to appear in the graphical user interface (no need to restart Thorium entirely, just the reader window) Could you please clarify? Thank you 👍

dolevu commented 3 years ago

It has been a few days and many restarts. It's still David as default on Thorium Windows. What registry key or configuration Thorium is reading the get the default voice on Windows 10?

danielweck commented 3 years ago

Thorium relies on a standardised Open Web Platform API to fetch the available system voices: speechSynthesisInstance.getVoices() https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis/getVoices

Each voice object has a default property (boolean) which we use to display the star / asterisk next to the voice label: https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesisVoice

When the Thorium user selects the first option in the GUI list labelled "Voice: system default", under the hood the TTS playback engine creates speech utterances with a non-defined / null voice, using the voice property of the SpeechSynthesisUtterance object:

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

This results in the default system voice being used when invoking the speak() function:

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

dolevu commented 3 years ago

It seems it's Windows problem. I tested with another version of Windows, and the default is still David.

ways2read commented 3 years ago

A little bit more information in case this helps. I am using Windows 11 with my localization set to UK. In the pull-down menu the default voice is indicated as David. My default voice in Windows settings is Susan. The voice actually used is George.

I wonder if the first or default is being used from UK English.

Thorium 1.7.3-alpha.1.1315905677

7cio commented 3 years ago

I have the same problem on Windows 10/11. Here is what I did to have the default voice that I like

Go to C:\Windows\Speech_OneCore\Engines\TTS\en-US Backup all David files Then make a copy of the files belong to the voice I like, then rename the files to David image

danielweck commented 3 years ago

A little bit more information in case this helps. I am using Windows 11 with my localization set to UK. In the pull-down menu the default voice is indicated as David. My default voice in Windows settings is Susan. The voice actually used is George.

I wonder if the first or default is being used from UK English.

Clearly, the "default" boolean property reported by the Chromium web speech interface is incorrect. I wish I could reproduce this bug in MacOS, but it looks like I will need to crank up a Windows virtual machine and investigate further.

Moonbase59 commented 2 years ago

No voice (and no selction apart from "Voice: system default) on Linux Mint 20.3. Tried with 1.8.0 and 2.0.0-alpha.1.1846759180 (AppImage). I have "the usual suspects" installed: espeak, spd and PicoTTS. (Not festival, though.)

danielweck commented 2 years ago

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

danielweck commented 2 years ago

Let's move this interesting thread to a GitHub discussion. As it stands now, and to the best of my understanding + test results, Thorium correctly relies on the information surfaced by Chromium. We do not directly interact with the operating system.