chinese-words-separator / chinese-words-separator.github.io

5 stars 1 forks source link

character voice #24

Closed Htyb closed 1 year ago

Htyb commented 1 year ago

Would it be possible to add a more natural-sounding character to the "read aloud" feature? Specifically, I would like to have the voices of Yunjian and Xiaoxiao from natural reader or Microsoft's immersive reader

chinese-words-separator commented 1 year ago

CWS uses Chrome's built-in Text-to-Speech API, but TTS API has a very few voice character choices for Chinese, tested the following voices from https://codepen.io/matt-west/pen/DpmMgE:

Ting-Ting (Enhanced)
Tingting
Google 普通话(中国大陆)
Google 國語(臺灣)

..but they all sound almost the same, and they don't sound as natural as Microsoft's reader

The Microsoft Bing Translator has a natural-sounding voice, CWS can play back the speech from Bing Translator. Steps here:

https://www.youtube.com/watch?v=UlPRPBe1D-g

Some Android devices's text to speech can be configured. If you are using CWS on Kiwi browser on an Android device, you can change the voice character (and gender) for text-to-speech

https://www.youtube.com/shorts/lO28Gt1R2iQ

https://www.youtube.com/watch/lO28Gt1R2iQ

Htyb commented 1 year ago

thank you so much for the answer!!! but it seems in some website this doesn't work, like chatGPT for example (https://chat.openai.com) Would you happen to know why?

Htyb commented 1 year ago

i mean "automatic read-aloud manually click the speaker icon once, then it should be automatic afterwards" section doesn't pop up in there

chinese-words-separator commented 1 year ago

Checked how OpenAI's chat website behaves against CWS. OpenAI's chat prevents third-party code from communicating states (like CWS transmitting text to translate back and forth to Microsoft Bing Translator, CWS simulating a click on Microsoft Bing Translator's speaker icon) via window object

image image

The window object is null when CWS opened a separate window (e.g., Microsoft Bing translator) in OpenAI's chat website. That makes CWS unable to simulate a click on Microsoft Bing Translator's window

Whereas on normal websites, when CWS opened a separate window, the window is not null, hence CWS can access the separately opened window, e.g.,

image

Thus CWS can simulate clicking on Microsoft Bing Translator's speaker icon on sites like above (e.g., purepen.com)

For now, Microsoft Bing Translator's read-aloud is not working on OpenAI chat until OpenAI allow third-party code to access the window object of the separately opened window, or if found another way to communicate states to separately opened window

Htyb commented 1 year ago

ok, i get it. it's really kind of you to go out of your way to look it up for me. i'm grateful and also feel a little bit sorry for the silly question but thanks anyway

chinese-words-separator commented 1 year ago

ok, i get it. it's really kind of you to go out of your way to look it up for me. i'm grateful and also feel a little bit sorry for the silly question but thanks anyway

No problem, you're welcome. Still need to find a different way to integrate CWS to translators so that translators will work regardless of a site's (e.g., OpenAI) technical intricacies