aardio 文档

com.sapi.voice 库模块帮助文档

com.sapi 成员列表

com.sapi.voice

SAPI语音对象,
SAPI为正常系统自带组件,如果是精简过删除了SAPI组件的系统请自行安装修复该组件

com.sapi.voice()

创建SAPI语音对象

返回对象:comsapivoiceObject

comsapivoiceObject 成员列表

comsapivoiceObject.displayUI(hWndParent,title,typeOfUI,extraData)

显示指定界面

comsapivoiceObject.eachVoices()

for name,lang,gender,age,vendor,description in comsapivoiceObject.eachVoices(){
    /*遍历所有语音库,  
name为名称,lang为语言代码,gender为性别,age为年龄,vendor为厂商,description为详细说明*/
}

comsapivoiceObject.event

回调事件表

返回对象:comsapivoiceeventObject

comsapivoiceObject.getStatus()

返回当前状态

返回对象:comsapivoicestatusObject

comsapivoiceObject.getVoicesEx()

返回数组,数组由所有语音库的属性列表组成
如果在参数中使用一个字符串参数指定要返回的属性,
则返回由所有语音库的对应属性值组成的数组

comsapivoiceObject.isUiSupported(typeOfUI,extraData)

是否支持指定界面

comsapivoiceObject.pause()

暂停朗读

comsapivoiceObject.rate

说话速度,值范围从 -10到10

comsapivoiceObject.resume()

继续朗读

comsapivoiceObject.setVoice()

设置当前语音库

comsapivoiceObject.setVoiceByAttributes(必需属性,可选属性)

使用属性设置语音库
属性使用"Attribute = Value"或者"Attribute != Value" 格式的字符串表示

comsapivoiceObject.setVoiceByIndex()

使用索引设置语音库

comsapivoiceObject.setVoiceByLanguage()

使用语言代码设置语音库
804 表示中文,409表示英文

comsapivoiceObject.setVoiceByName()

使用名称设置语音库

comsapivoiceObject.skip(type,numItems)

跳过指定的文本

comsapivoiceObject.speak(text,flags)

朗读,text参数指定要朗读的字符串
flags为可选参数,可指定如下值:
SVSFDefault = 0
SVSFlagsAsync = 1
SVSFPurgeBeforeSpeak = 2
SVSFIsFilename = 4
SVSFIsXML = 8
SVSFIsNotXML = 16
SVSFPersistXML = 32
SVSFNLPSpeakPunc = 64
SVSFNLPMask = 64
SVSFVoiceMask = 127
SVSFUnusedFlags = -128

comsapivoiceObject.speakAsync(text,flags)

异步非阻塞朗读,text参数指定要朗读的字符串
flags为可选参数,参考speak函数flags参数的说明
此函数与speak用法相同,但flags默认指定了SVSFlagsAsync选项

comsapivoiceObject.speakCompleteEvent()

返回一个用于等待的事件句柄,
可作为 thread.waitOne 的参数使用

comsapivoiceObject.speakStream(stream,flags)

朗读文件流,例如SAPI.SpFileStream

comsapivoiceObject.speakXml(text,flags)

异步非阻塞朗读XML格式文本,text参数指定要朗读的字符串
flags为可选参数,参考speak函数flags参数的说明
此函数与speak用法相同,但flags默认指定了SVSFlagsAsync,SVSFIsXML选项

comsapivoiceObject.status

当前状态

返回对象:comsapivoicestatusObject

comsapivoiceObject.voice

当前语音库

comsapivoiceObject.volume

音量,值范围从 0到100

comsapivoiceObject.waitOne()

异步朗读时,可使用此函数等待朗读结束

comsapivoiceObject.waitUntilDone(_)

等待直到完成,参数指定超时,超时指定为-1表示直到朗读完成

comsapivoiceeventObject 成员列表

comsapivoiceeventObject.AudioLevel

comsapivoiceeventObject.AudioLevel = function(streamNumber,streamPosition,audioLevel){ 
    /*音频变化触发*/  
}

comsapivoiceeventObject.EndStream

comsapivoiceeventObject.EndStream = function(streamNumber ,streamPosition){ 

}

comsapivoiceeventObject.EnginePrivate

comsapivoiceeventObject.EnginePrivate =  function(streamNumber,streamPosition,engineData){

}

comsapivoiceeventObject.Phoneme

comsapivoiceeventObject.Phoneme =  function(streamNumber, streamPosition,Duration,nextPhoneId,Feature,currentPhoneId){
   /*新的音素*/
}

comsapivoiceeventObject.Sentence

comsapivoiceeventObject.Sentence =  function(streamNumber,streamPosition,characterPosition,length){
   /*新的句子*/
}

comsapivoiceeventObject.StartStream

comsapivoiceeventObject.StartStream = function(streamNumber,streamPosition ){ 

}

comsapivoiceeventObject.Viseme

comsapivoiceeventObject.Viseme =  function(streamNumber,streamPosition,duration,nextVisemeId,feature,currentVisemeId){
   /*新的嘴形*/
}

comsapivoiceeventObject.VoiceChange

comsapivoiceeventObject.VoiceChange =  function(streamNumber,streamPosition ,voiceObjectToken ){ 
    var v = voiceObjectToken.GetDescription();
}

comsapivoiceeventObject.Word

comsapivoiceeventObject.Word =  function(streamNumber,streamPosition,characterPosition,length ){ 
   /*一个新单词开始*/
}

comsapivoicestatusObject 成员列表

comsapivoicestatusObject.currentStreamNumber

输入流数目.

comsapivoicestatusObject.inputSentenceLength

当前语句长度

comsapivoicestatusObject.inputSentencePosition

当前语句开始位置

comsapivoicestatusObject.inputWordLength

当前朗读的单词长度

comsapivoicestatusObject.inputWordPosition

当前朗读的单词开始位置

comsapivoicestatusObject.lastBookmark

最后一个书签的字符串值

comsapivoicestatusObject.lastBookmarkId

最后一个书签的ID

comsapivoicestatusObject.lastHResult

最后一次调用speak,speakStream的状态码

comsapivoicestatusObject.lastStreamNumberQueued

朗读的最后一个音频流编号

comsapivoicestatusObject.phonemeId

当前音素ID

comsapivoicestatusObject.runningState

当前朗读状态
SRSEIsSpeaking 值为2 表示正在朗读
SRSEDone 值为1表示朗读已完成

comsapivoicestatusObject.visemeId

当前口形ID

Markdown 格式