chcg / SpeechPlugin

Unofficial version of https://sourceforge.net/projects/npp-plugins/files/SpeechPlugin/
GNU General Public License v2.0
8 stars 1 forks source link

How to select the voice used to read the text? #10

Open JEAYNE opened 11 months ago

JEAYNE commented 11 months ago

Hi, I've installed several voices (English and French) , but the voice used by the plugin is always the same: Microsoft Suzan Changing the default voice in Windows Settings has no effect on the voice used by the plugin. Is there a way to choose the voice used by the plugin (even by editing a configuration file ;-) ?

Note: Using the default English voice for French texts is sometimes hilarious, but not useful...

Regards

chcg commented 11 months ago

Seems it is relevant at which order the voices are registered at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices , see https://learn.microsoft.com/en-us/previous-versions/windows/desktop/ee125021(v=vs.85)

as there is no specific selection by:

https://github.com/chcg/SpeechPlugin/blob/f11a61b2c11e77dd9a6cb900df82453a52245d0c/SpeechPlugin.cpp#L303

An additional interface would be necessary to be able to enumerate and select a specific voice.

JEAYNE commented 11 months ago

It looks like there are two lists of voices in the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech\Voices\Tokens
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Speech_OneCore\Voices\Tokens

On my Win11 machine 'Speech\Voices\Tokens’ is a subset of the list in '_SpeechOneCore\Voices\Tokens'

I hope you will find the time to add a voice selector to the plugin. Thanks.

superluig164 commented 9 months ago

You can change this by selecting the voice in Control Panel > Speech Recognition > Text To Speech. In the Microsoft API documentation, it specifically mentions that the default voice will be used if it isn't specified in code. The difference is that the default voice set in Settings is not the same as the one set in Control Panel nor is it the same as the setting for Narrator.

The voice selected in Settings references both lists, and the selection in Control Panel references only the Speech list. If you want one voice in the other list, you can manually copy the registry values over, and it will work fine. I did this to use Microsoft Richard with the plugin, as for me, it only showed up in Settings at first.