Class SttClient
Definition
- Assembly:
- Tizen.Uix.Stt.dll
A main function of Speech-To-Text (below STT) API recognizes sound data recorded by users. After choosing a language, the applications will start recording and recognizing. After recording, the applications will receive the recognized result. The STT has a client-server for the service of multi-applications. The STT service always works in the background as a server. If the service is not working, client library will invoke it and the client will communicate with it. The service has engines and a recorder, so that the client does not have the recorder itself. Only the client request commands to the STT service for using STT.
public class SttClient : IDisposable
- Inheritance
-
objectSttClient
- Implements
-
System.IDisposable
Constructors
View SourceSttClient()
Constructor to create a STT instance.
Declaration
public SttClient()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to operation failed. |
System.OutOfMemoryException | This exception can be due to out of memory. |
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
Properties
View SourceCurrentState
Gets the current STT state.
Declaration
public State CurrentState { get; }
Property Value
Type | Description |
---|---|
State | Current state of STT. |
DefaultLanguage
Gets the default language set by the user. The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code. For example, "ko_KR" for Korean, "en_US" for American English.
Declaration
public string DefaultLanguage { get; }
Property Value
Type | Description |
---|---|
string | Default language in STT. |
Engine
This property can be used to get and set the current engine id.
Declaration
public string Engine { get; set; }
Property Value
Type | Description |
---|---|
string | Current STT engine id. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exceptioncan occur while setting due to the following reasons:
|
System.OutOfMemoryException | This exception can be due to out of memory. |
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
System.ArgumentException | This can happen if improper EngineId is provided while setting the value. |
RecordingVolume
Gets the microphone volume during recording.
Declaration
public float RecordingVolume { get; }
Property Value
Type | Description |
---|---|
float | Recording volume in STT. |
Methods
View SourceCancel()
Cancels processing the recognition and recording asynchronously. This function cancels recording and the engine cancels recognition processing. After successful cancellation, the StateChanged event is invoked, otherwise if an error is occurs, the ErrorOccurred event is invoked.
Declaration
public void Cancel()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
Dispose()
Method to release resources.
Declaration
public void Dispose()
Dispose(bool)
Method to release resources.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | The boolean value for destoying stt handle. |
~SttClient()
Destructor to destroy a STT instance.
Declaration
protected ~SttClient()
GetDetailedResult()
Retrieves the time stamp of the current recognition result.
Declaration
public IEnumerable<ResultTime> GetDetailedResult()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><ResultTime> | List of ResultTime. |
Remarks
This function should only be called in the RecognitionResult event.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to operation failed. |
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
GetPrivateData(string)
Gets the private data from the STT engine.
Declaration
public string GetPrivateData(string key)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key string. |
Returns
Type | Description |
---|---|
string | The data corresponding to the key is provided. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to invalid state. |
System.NotSupportedException | This exception can be due to STT not supported. |
System.TimeoutException | This exception can be due to No Answer from STT Service. |
GetSupportedEngines()
Gets the list of supported engines.
Declaration
public IEnumerable<SupportedEngine> GetSupportedEngines()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><SupportedEngine> | IEnumerable<SupportedEngine> list of supported engines. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to operation failed. |
System.OutOfMemoryException | This exception can be due to out of memory. |
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
GetSupportedLanguages()
Retrieves all the supported languages of the current engine. The language is specified as an ISO 3166 alpha-2 two letter country-code followed by ISO 639-1 for the two-letter language code. For example, "ko_KR" for Korean, "en_US" for American English.
Declaration
public IEnumerable<string> GetSupportedLanguages()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T><string> | List of strings for supported languages. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
IsRecognitionTypeSupported(RecognitionType)
Checks whether the recognition type is supported.
Declaration
public bool IsRecognitionTypeSupported(RecognitionType type)
Parameters
Type | Name | Description |
---|---|---|
RecognitionType | type | RecognitionType value. |
Returns
Type | Description |
---|---|
bool | Bool value indicating whether the recognition type is supported. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to STT not supported. |
Prepare()
Connects to the STT service asynchronously.
Declaration
public void Prepare()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to invalid state. |
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
SetCredential(string)
Sets the application credential.
Declaration
public void SetCredential(string credential)
Parameters
Type | Name | Description |
---|---|---|
string | credential | The credential string. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exceptioncan be due to the following reasons:
|
System.OutOfMemoryException | This exception can be due to out of memory. |
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
System.ArgumentException | This can happen if Improper value is provided while setting the value. |
SetPrivateData(string, string)
Sets the private data to the STT engine.
Declaration
public void SetPrivateData(string key, string data)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key string. |
string | data | The data string. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to invalid state. |
System.NotSupportedException | This exception can be due to STT not supported. |
System.TimeoutException | This exception can be due to No Answer from STT Service. |
System.ArgumentException | This can happen if Improper value is provided while setting the value. |
SetSilenceDetection(SilenceDetection)
Sets the silence detection.
Declaration
public void SetSilenceDetection(SilenceDetection type)
Parameters
Type | Name | Description |
---|---|---|
SilenceDetection | type | SilenceDetection value. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to STT not supported. |
SetStartSound(string)
Sets the sound to start recording. Sound file type should be .wav type.
Declaration
public void SetStartSound(string filePath)
Parameters
Type | Name | Description |
---|---|---|
string | filePath | File path for the sound. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
System.ArgumentException | If an Invalid Parameter is provided. |
SetStopSound(string)
Sets the sound to stop recording. Sound file type should be .wav type.
Declaration
public void SetStopSound(string filePath)
Parameters
Type | Name | Description |
---|---|---|
string | filePath | File Path for the sound. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
System.ArgumentException | This exception can be due to Invalid Parameter. |
Start(string, RecognitionType)
Starts the recording and recognition asynchronously. This function starts recording in the STT service and sends the recording data to the engine. This work continues until stop, cancel, or silence is detected by engine.
Declaration
public void Start(string language, RecognitionType type)
Parameters
Type | Name | Description |
---|---|---|
string | language | The language selected. |
RecognitionType | type | The type for recognition. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
System.ArgumentException | This exception can be due to an invalid language. |
Stop()
Finishes the recording and starts recognition processing in the engine asynchronously.
Declaration
public void Stop()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
Unprepare()
Disconnects from the STT service.
Declaration
public void Unprepare()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to invalid state. |
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
UnsetStartSound()
Unsets the sound to start recording.
Declaration
public void UnsetStartSound()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | This exception can be due to permission denied. |
UnsetStopSound()
Unsets the sound to stop recording.
Declaration
public void UnsetStopSound()
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | This exception can be due to the following reasons:
|
System.NotSupportedException | This exception can be due to STT not supported. |
System.UnauthorizedAccessException | his exception can be due to permission denied. |
Events
View SourceDefaultLanguageChanged
Event to be invoked when the default language changes.
Declaration
public event EventHandler<DefaultLanguageChangedEventArgs> DefaultLanguageChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><DefaultLanguageChangedEventArgs> |
EngineChanged
Event to be invoked to detect the engine change.
Declaration
public event EventHandler<EngineChangedEventArgs> EngineChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><EngineChangedEventArgs> |
ErrorOccurred
Event to be invoked when an error occurs.
Declaration
public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><ErrorOccurredEventArgs> |
RecognitionResult
Event to be invoked when the recognition is done.
Declaration
public event EventHandler<RecognitionResultEventArgs> RecognitionResult
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><RecognitionResultEventArgs> |
StateChanged
Event to be invoked when the STT state changes.
Declaration
public event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><StateChangedEventArgs> |