如何使用微軟的SAPI實現發音功能?

2021-04-13 08:43:52 字數 824 閱讀 5841

download the microsoft speech sdk 5.1 package now.

下面的**寫的是入門級**,希望對你有用!

ispvoice * m_pvoice = null;

hresult hr = cocreateinstance(clsid_spvoice, null, clsctx_all, iid_ispvoice, (void **)&m_pvoice);

if( succeeded( hr ) )

//get the closest token

if(succeeded(hr))

//set the voice

if(succeeded(hr))

//set the output to the default audio device

if(succeeded(hr))

//m_pvoice->setinterest( spfei(spei_word_boundary),spfei(spei_word_boundary) );

hr = m_pvoice->speak(l"hello joely!", spf_default, null);

// 這裡使用xml的格式調整法音,如頻率,音調等,具體看sdk的幫助文件,寫的比較詳細

hr = m_pvoice->speak(l"this sounds normal but the pitch drops half way through", spf_is_xml, null );

m_pvoice->release();

m_pvoice = null;

**需要經過本人許可,謝謝!

利用微軟的SAPI進行語音合成

利用微軟的sapi進行語音合成 簡介微軟提供了乙個很好的工具用於語音識別與合成,所用的就是微軟的 speech api。在這裡我來介紹sapi的各項功能。如何使用 為了合成語音,我們需要引用system.speech.synthesis 命名空間。這個主類是speechsynthesizer。你可以...

如何使用微軟的SDK

這兩年來接觸過微軟的sdk 有 mfc speech sdk directx sdk windows driver kit windows sdk 像我這樣普通的程式設計師真是跟民工沒有什麼區別。從來都是在別人的基礎上程式設計,一直沒有自己核心的東西。然而,民工也是分三六九等的 民工做久了也會有一些...

SAPI使用總結 SpVoice的使用方法

最近使用c 重做了點名系統 要用到tts,讓計算機點名 使用了sapi,在這裡總結一下spvoice的使用方法。初始化物件,spvoice voice new dotnetspeech.spvoiceclass 朗讀時,使用 voice.speak string,speechvoicespeakfl...