API reference

WitTTSVRequest Class

A WitVRequest subclass for handling TTS requests

Constructors

WitTTSVRequest ( configuration , requestId , textToSpeak , ttsData , audioFileType , audioStream , useEvents , onDownloadProgress , onFirstResponse )
Constructor for wit based text-to-speech VRequests
Signature
Meta.WitAi.Requests.WitTTSVRequest.WitTTSVRequest(IWitRequestConfiguration configuration, string requestId, string textToSpeak, Dictionary< string, string > ttsData, TTSWitAudioType audioFileType, bool audioStream=false, bool useEvents=false, RequestProgressDelegate onDownloadProgress=null, RequestFirstResponseDelegate onFirstResponse=null)
Parameters
configuration: IWitRequestConfiguration  The configuration interface to be used
requestId: string  A unique identifier that can be used to track the request
textToSpeak: string  The text to be spoken by the request
ttsData: Dictionary< string, string >  The text parameters used for the request
audioFileType: TTSWitAudioType  The expected audio file type of the request
audioStream: bool  Whether the audio should be played while streaming or should wait until completion.
useEvents: bool  Whether or not events should be requested with this audio request
onDownloadProgress: RequestProgressDelegate  The callback for progress related to downloading
onFirstResponse: RequestFirstResponseDelegate  The callback for the first response of data from a request

Properties

FileType : TTSWitAudioType
[Get]
Signature
TTSWitAudioType Meta.WitAi.Requests.WitTTSVRequest.FileType
Stream : bool
[Get]
Signature
bool Meta.WitAi.Requests.WitTTSVRequest.Stream
TextToSpeak : string
[Get]
Signature
string Meta.WitAi.Requests.WitTTSVRequest.TextToSpeak
TtsData : Dictionary< string, string >
[Get]
Signature
Dictionary<string, string> Meta.WitAi.Requests.WitTTSVRequest.TtsData
UseEvents : bool
[Get]
Signature
bool Meta.WitAi.Requests.WitTTSVRequest.UseEvents

Protected Methods

GetHeaders ()
Signature
override Dictionary<string, string> Meta.WitAi.Requests.WitTTSVRequest.GetHeaders()
Returns
override Dictionary< string, string >

Methods

RequestDownload ( downloadPath , onComplete )
Performs a wit tts request that streams audio data into the a specific path on disk.
Signature
string Meta.WitAi.Requests.WitTTSVRequest.RequestDownload(string downloadPath, RequestCompleteDelegate< bool > onComplete)
Parameters
downloadPath: string  Path to download the audio clip to
onComplete: RequestCompleteDelegate< bool >  The callback when the clip is either completely downloaded or failed to download
Returns
string  An error string if applicable
RequestStream ( onSamplesDecoded , onJsonDecoded , onComplete )
Performs a wit tts request that streams audio data into the provided audio clip stream.
Signature
string Meta.WitAi.Requests.WitTTSVRequest.RequestStream(AudioSampleDecodeDelegate onSamplesDecoded, AudioJsonDecodeDelegate onJsonDecoded, RequestCompleteDelegate< bool > onComplete)
Parameters
onSamplesDecoded: AudioSampleDecodeDelegate  Called one or more times as audio samples are decoded.
onJsonDecoded: AudioJsonDecodeDelegate  Called one or more times as json data is decoded.
onComplete: RequestCompleteDelegate< bool >  Called when the audio request has completed
Returns
string  An error string if applicable

Static Methods

GetWebErrors ( textToSpeak , configuration )
Method for determining if there are problems that will arise with performing a web request prior to doing so
Signature
static string Meta.WitAi.Requests.WitTTSVRequest.GetWebErrors(string textToSpeak, IWitRequestConfiguration configuration)
Parameters
textToSpeak: string
Returns
string