Does anyone know a way to programmatically create and / or select voice profiles in SAPI?

I need to provide users with an easy way, without going into the control panel, to select a voice profile. I found: Acoustic preparation using the SAPI 5.3 Speech API but no examples, and the information is incomplete.

I could really use an example if anyone has :)

+3
source share
2 answers

The default profile with a flag next to it in the speech control panel is determined by the registry entry:

[HKEY_CURRENT_USER\Software\Microsoft\Speech\RecoProfiles]
"DefaultTokenId"="HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Speech\\RecoProfiles\\Tokens\\{A32BEAC3-4442-4E13-B485-8A2DD7178794}"

, GUI/ Windows Speech Recognition. " ".

SetRecoProfile. , , , ...

0

. .

IEnumSpObjectTokens *pProfileEnum;
SpEnumTokens(SPCAT_RECOPROFILES, NULL, NULL, &pProfileEnum);

unsigned long l;
pProfileEnum->GetCount(&l);

for (int i = 0; i < (int) l; i++)
{
    CComPtr<ISpObjectToken> IT;
    pProfileEnum->Item(i, &IT);
    WCHAR *wptr;
    IT->GetId(&wptr);
    CSpDynamicString dstrDefaultName;
    SpGetDescription(IT, &dstrDefaultName);
    //Do something to select the profile withe the name you would like to use
}  


//Assuming IT is the profile you want to use, activat it by calling:
cpRecognizer->SetRecoProfile(IT);
0

Source: https://habr.com/ru/post/1766448/


All Articles