我正在使用Speech Platform for TTS(文本到語音)。Microsoft Speech Platform:「SPF_NLP_SPEAK_PUNC」不起作用
我想獲得符號發音(標點符號)的語音輸出。
MSDN說:
ISpVoice::Speak speaks the contents of a text string or file.
HRESULT Speak(
LPCWSTR *pwcs,
DWORD dwFlags,
ULONG *pulStreamNumber
);
...
dwFlags
[in] Flags used to control the rendering process for this call. The flag values are contained in the SPEAKFLAGS enumeration.
...
http://msdn.microsoft.com/en-us/library/speechplatform_ispvoice_speak.aspx
SPEAKFLAGS
...
SPF_NLP_SPEAK_PUNC
Punctuation characters should be expanded into words (for example, "This is a sentence." would become "This is a sentence period").
...
http://msdn.microsoft.com/en-us/library/speechplatform_speakflags.aspx
所以,我寫了下面的代碼:
#define TOKEN_ID L"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Speech Server\\v11.0\\Voices\\Tokens\\TTS_MS_en-US_Helen_11.0"
int main(void) {
CoInitialize(NULL);
ISpVoice* spVoice = NULL;
CoCreateInstance(CLSID_SpVoice, NULL,
CLSCTX_INPROC_SERVER, IID_ISpVoice, (void**)&spVoice);
ISpObjectToken* token = NULL;
SpGetTokenFromId(TOKEN_ID, &token, FALSE);
spVoice->SetVoice(token);
spVoice->Speak(L"This is a sentence.",
SPF_DEFAULT | SPF_NLP_SPEAK_PUNC, NULL);
CoUninitialize();
return 0;
}
但這不按預期工作。 這輸出「這是一個句子」的演講,而不是發音「時期」。
請幫幫我。
您使用哪種語音? –