Click here to Skip to main content
15,881,898 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want

GetAttribute(xyz)


to be something like:

GetAttribute("Language")


And then a language is returned as a string maybe, as I want to categorize dozens of voices that the user may have into categories based on their language, I want
GetAttribute("Language")


To return:
"eng-us"
or
"English - United States"
or
"German-Germany"
or
"Arabic-Saudi Arabia"
or
"Spanish-Spain"

So what should I use instead of "Language"?

And what if I want to know if it's a voice of a male or a female?

What I have tried:

SpObjectTokenCategory otc = new SpObjectTokenCategory();

            otc.SetId("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech_OneCore\\Voices");

            ISpeechObjectTokens tokenEnum = otc.EnumerateTokens();

            

            foreach (SpeechLib.ISpeechObjectToken v in tokenEnum)
            {
                string s = v.GetDescription();// thid doesn't always return the language sometimes only the name of the voice
                string a = v.GetAttribute(/*what here?*/);
Posted
Updated 21-Aug-21 3:04am
v2
Comments
[no name] 21-Aug-21 13:04pm    
Get the default (speech) voice. Voice properties include gender, etc.

https://docs.microsoft.com/en-us/dotnet/api/system.speech.synthesis.speechsynthesizer.voice?view=netframework-4.8
john1990_1 21-Aug-21 13:12pm    
Thx but this is for:
System.Speech.Synthesis speechsynthesizer
Not for
Speechlib SpVoice

I would have to change all of my program, is there an easier way for me?
[no name] 22-Aug-21 12:16pm    
Same thing. Yours is the "assembler" version.

https://www.ghacks.net/2018/08/11/unlock-all-windows-10-tts-voices-system-wide-to-get-more-of-them/

You started out difficult; and continue with difficult.
john1990_1 22-Aug-21 12:41pm    
You mean it's better that I switch to:
"System.Speech.Synthesis speechsynthesizer"
instead of:
"Speechlib SpVoice",
Will I have to change a lot in my program or it's basically the same code?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900