Class SttClient

Definition

Namespace:
Tizen.Uix.Stt
Assembly:
Tizen.Uix.Stt.dll
API Level:
3

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.

C#
Copy
public class SttClient : IDisposable
Inheritance
System.Object
SttClient
Implements
System.IDisposable

Constructors

View Source

SttClient()

Constructor to create a STT instance.

Declaration
C#
Copy
public SttClient()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to operation failed.

OutOfMemoryException

This exception can be due to out of memory.

System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone

Properties

View Source

CurrentState

Gets the current STT state.

Declaration
C#
Copy
public State CurrentState { get; }
Property Value
Type Description
State

Current state of STT.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
View Source

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
C#
Copy
public string DefaultLanguage { get; }
Property Value
Type Description
System.String

Default language in STT.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
View Source

Engine

This property can be used to get and set the current engine id.

Declaration
C#
Copy
public string Engine { get; set; }
Property Value
Type Description
System.String

Current STT engine id.

Exceptions
Type Condition
System.InvalidOperationException

This exceptioncan occur while setting due to the following reasons:

  1. Operation Failed
  2. Invalid State
OutOfMemoryException

This exception can be due to out of memory.

System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

System.ArgumentException

This can happen if improper EngineId is provided while setting the value.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Precondition: The state must be created.
View Source

RecordingVolume

Gets the microphone volume during recording.

Declaration
C#
Copy
public float RecordingVolume { get; }
Property Value
Type Description
System.Single

Recording volume in STT.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Precondition: The state must be recording.

Methods

View Source

Cancel()

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
C#
Copy
public void Cancel()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Operation Failed
  3. Progress to ready is not finished
  4. Progress to recording is not finished
  5. Progress to processing is not finished
System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state should be Recording or Processing.
Postcondition: It will invoke the StateChanged event, if registered. If this function succeeds, the STT state will be ready. If you call this function again before the state changes, you will receive ErrorINProgressToReady.
View Source

Dispose()

Method to release resources.

Declaration
C#
Copy
public void Dispose()
API Level: 3
View Source

Dispose(Boolean)

Method to release resources.

Declaration
C#
Copy
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing

The boolean value for destoying stt handle.

API Level: 3
View Source

Finalize()

Destructor to destroy a STT instance.

Declaration
C#
Copy
protected void Finalize()
View Source

GetDetailedResult()

Retrieves the time stamp of the current recognition result.

Declaration
C#
Copy
public IEnumerable<ResultTime> GetDetailedResult()
Returns
Type Description
System.Collections.Generic.IEnumerable<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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
View Source

GetPrivateData(String)

Gets the private data from the STT engine.

Declaration
C#
Copy
public string GetPrivateData(string key)
Parameters
Type Name Description
System.String key

The key string.

Returns
Type Description
System.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.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state must be ready.
View Source

GetSupportedEngines()

Gets the list of supported engines.

Declaration
C#
Copy
public IEnumerable<SupportedEngine> GetSupportedEngines()
Returns
Type Description
System.Collections.Generic.IEnumerable<SupportedEngine>

IEnumerable<SupportedEngine> list of supported engines.

Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to operation failed.

OutOfMemoryException

This exception can be due to out of memory.

System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
View Source

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
C#
Copy
public IEnumerable<string> GetSupportedLanguages()
Returns
Type Description
System.Collections.Generic.IEnumerable<System.String>

List of strings for supported languages.

Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Engine Not Found.
  2. Operation Failed.
System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 4
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
View Source

IsRecognitionTypeSupported(RecognitionType)

Checks whether the recognition type is supported.

Declaration
C#
Copy
public bool IsRecognitionTypeSupported(RecognitionType type)
Parameters
Type Name Description
RecognitionType type

RecognitionType value.

Returns
Type Description
Boolean

Bool value indicating whether the recognition type is supported.

Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Engine Not Found
  3. Operation Failed
System.NotSupportedException

This exception can be due to STT not supported.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state should be ready.
View Source

Prepare()

Connects to the STT service asynchronously.

Declaration
C#
Copy
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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state must be created.
Postcondition: If this function is successful, the STT state will be ready. If this function is unsuccessful, ErrorOccurred event will be invoked.
View Source

SetCredential(String)

Sets the application credential.

Declaration
C#
Copy
public void SetCredential(string credential)
Parameters
Type Name Description
System.String credential

The credential string.

Exceptions
Type Condition
System.InvalidOperationException

This exceptioncan be due to the following reasons:

  1. Operation Failed
  2. Invalid State
OutOfMemoryException

This exception can be due to out of memory.

System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

System.ArgumentException

This can happen if Improper value is provided while setting the value.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state must be created.
View Source

SetPrivateData(String, String)

Sets the private data to the STT engine.

Declaration
C#
Copy
public void SetPrivateData(string key, string data)
Parameters
Type Name Description
System.String key

The key string.

System.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.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state must be ready.
View Source

SetSilenceDetection(SilenceDetection)

Sets the silence detection.

Declaration
C#
Copy
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:

  1. Invalid State
  2. Not supported feature of current engine
  3. Operation Failed
System.NotSupportedException

This exception can be due to STT not supported.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state should be ready.
View Source

SetStartSound(String)

Sets the sound to start recording. Sound file type should be .wav type.

Declaration
C#
Copy
public void SetStartSound(string filePath)
Parameters
Type Name Description
System.String filePath

File path for the sound.

Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Operation Failed
System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

System.ArgumentException

If an Invalid Parameter is provided.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state should be ready.
View Source

SetStopSound(String)

Sets the sound to stop recording. Sound file type should be .wav type.

Declaration
C#
Copy
public void SetStopSound(string filePath)
Parameters
Type Name Description
System.String filePath

File Path for the sound.

Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Operation Failed
System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

System.ArgumentException

This exception can be due to Invalid Parameter.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state should be ready.
View Source

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
C#
Copy
public void Start(string language, RecognitionType type)
Parameters
Type Name Description
System.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:

  1. Invalid State
  2. Operation Failed
  3. Recorder Busy
  4. Progress to recording is not finished
System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

System.ArgumentException

This exception can be due to an invalid language.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state should be ready.
Postcondition: It will invoke the StateChanged event, if registered. If this function succeeds, the STT state will be recording. If you call this function again before the state changes, you will receive ErrorINProgressToRecording.
View Source

Stop()

Finishes the recording and starts recognition processing in the engine asynchronously.

Declaration
C#
Copy
public void Stop()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Operation Failed
  3. Progress to ready is not finished
  4. Progress to recording is not finished
  5. Progress to processing is not finished
System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state should be Recording.
Postcondition: It will invoke the StateChanged Event, if registered. If this function succeeds, the STT state will be processing. If you call this function again before the state changes, you will receive ErrorINProgressToProcessing. After processing of engine, the RecognitionResult event is invoked.
View Source

Unprepare()

Disconnects from the STT service.

Declaration
C#
Copy
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.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state must be ready.
Postcondition: If this function is successful, the STT state will be Created.
View Source

UnsetStartSound()

Unsets the sound to start recording.

Declaration
C#
Copy
public void UnsetStartSound()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Operation Failed
System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

This exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state should be ready.
View Source

UnsetStopSound()

Unsets the sound to stop recording.

Declaration
C#
Copy
public void UnsetStopSound()
Exceptions
Type Condition
System.InvalidOperationException

This exception can be due to the following reasons:

  1. Invalid State
  2. Operation Failed
System.NotSupportedException

This exception can be due to STT not supported.

UnauthorizedAccessException

his exception can be due to permission denied.

API Level: 3
Privilege Level: public
Privilege: http://tizen.org/privilege/recorder
Feature: http://tizen.org/feature/speech.recognition http://tizen.org/feature/microphone
Precondition: The state should be ready.

Events

View Source

DefaultLanguageChanged

Event to be invoked when the default language changes.

Declaration
C#
Copy
public event EventHandler<DefaultLanguageChangedEventArgs> DefaultLanguageChanged
Event Type
Type Description
System.EventHandler<DefaultLanguageChangedEventArgs>
API Level: 3
View Source

EngineChanged

Event to be invoked to detect the engine change.

Declaration
C#
Copy
public event EventHandler<EngineChangedEventArgs> EngineChanged
Event Type
Type Description
System.EventHandler<EngineChangedEventArgs>
API Level: 3
View Source

ErrorOccurred

Event to be invoked when an error occurs.

Declaration
C#
Copy
public event EventHandler<ErrorOccurredEventArgs> ErrorOccurred
Event Type
Type Description
System.EventHandler<ErrorOccurredEventArgs>
API Level: 4
View Source

RecognitionResult

Event to be invoked when the recognition is done.

Declaration
C#
Copy
public event EventHandler<RecognitionResultEventArgs> RecognitionResult
Event Type
Type Description
System.EventHandler<RecognitionResultEventArgs>
API Level: 3
View Source

StateChanged

Event to be invoked when the STT state changes.

Declaration
C#
Copy
public event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type Description
System.EventHandler<StateChangedEventArgs>
API Level: 3

Implements

System.IDisposable