4

I need to give users an easy way, without going to the control panel, to select a speech profile. I found: Acoustic training using SAPI 5.3 Speech API but there are no examples and the information is incomplete.

I could really use an example, if anyone has one :)

Community
  • 1
  • 1
Matt H
  • 41
  • 1
  • I'd be perfectly happy if someone has figured out a way to run the built in speech recognition voice training and select existing profiles that way rather than the example creating it's own training. – Matt H Sep 24 '10 at 17:55

2 Answers2

1

The following code snippet might help to select a recognition profile. I did not yet try to make new profiles programmatically.

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);
Glanebridge
  • 71
  • 1
  • 1
  • 3
1

The "default" profile with the "check box" 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}"

I think this configuration setting is only read when the Windows Speech Recognition GUI / Control Panel starts up. So just modifying this registry value directly may not be useful for changing the profile "at runtime."

For changing the profile at runtime, you might look into using the SetRecoProfile function. Getting to the point where you can call that function is an involved topic, though...

Mike Clark
  • 9,026
  • 2
  • 35
  • 49