SpeechConfig Class

Definition

Speech configuration. Changed in version 1.7.0.

public class SpeechConfig
Inheritance
java.lang.Object
Closeable
SpeechConfig

Methods

close()

Dispose of associated resources.

enableAudioLogging()

Enable audio logging in service. Added in version 1.5.0.

enableDictation()

Enable dictation. Only supported in speech continuous recognition. Added in version 1.5.0.

fromAuthorizationToken(String authorizationToken, String region)

Creates an instance of a speech config with specified authorization token and service region. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. As configuration values are copied when creating a new recognizer, the new token value will not apply to recognizers that have already been created. For recognizers that have been created before, you need to set authorization token of the corresponding recognizer to refresh the token. Otherwise, the recognizers will encounter errors during recognition.

fromEndpoint(java.net.URI endpoint)

Creates an instance of the speech config with specified endpoint. This method is intended only for users who use a non-standard service endpoint or parameters. Note: The query parameters specified in the endpoint URI are not changed, even if they are set by any other APIs. For example, if the recognition language is defined in URI as query parameter "language=de-DE", and also set by setSpeechRecognitionLanguage("en-US"), the language setting in URI takes precedence, and the effective language is "de-DE". Only the parameters that are not specified in the endpoint URI can be set by other APIs. Note: if the endpoint requires a subscription key for authentication, please use fromEndpoint(java.net.URI, String) to pass the subscription key as parameter. To use an authorization token with fromEndpoint, use this method to create a SpeechConfig instance, and then call setAuthorizationToken() on the created SpeechConfig instance. Note: Added in version 1.5.0.

fromEndpoint(java.net.URI endpoint, String subscriptionKey)

Creates an instance of the speech config with specified endpoint and subscription key. This method is intended only for users who use a non-standard service endpoint or parameters. Note: The query parameters specified in the endpoint URI are not changed, even if they are set by any other APIs. For example, if the recognition language is defined in URI as query parameter "language=de-DE", and also set by setSpeechRecognitionLanguage("en-US"), the language setting in URI takes precedence, and the effective language is "de-DE". Only the parameters that are not specified in the endpoint URI can be set by other APIs. Note: To use an authorization token with fromEndpoint, please use fromEndpoint(java.net.URI), and then call setAuthorizationToken() on the created SpeechConfig instance.

fromHost(java.net.URI host)

Creates an instance of the speech config with specified host. This method is intended only for users who use a non-default service host. Standard resource path will be assumed. For services with a non-standard resource path or no path at all, use fromEndpoint instead. Note: Query parameters are not allowed in the host URI and must be set by other APIs. Note: If the host requires a subscription key for authentication, use fromHost(java.net.URI, String) to pass the subscription key as parameter. To use an authorization token with fromHost, use this method to create a SpeechConfig instance, and then call setAuthorizationToken() on the created SpeechConfig instance. Note: Added in version 1.8.0.

fromHost(java.net.URI host, String subscriptionKey)

Creates an instance of the speech config with specified host and subscription key. This method is intended only for users who use a non-default service host. Standard resource path will be assumed. For services with a non-standard resource path or no path at all, use fromEndpoint instead. Note: Query parameters are not allowed in the host URI and must be set by other APIs. Note: To use an authorization token with fromHost, use fromHost(java.net.URI), and then call setAuthorizationToken() on the created SpeechConfig instance. Note: Added in version 1.8.0.

fromSubscription(String subscriptionKey, String region)

Creates an instance of a speech config with specified subscription key and service region.

getAuthorizationToken()

Gets the authorization token.

getEndpointId()

Gets the endpoint ID of a customized speech model that is used for speech recognition.

getOutputFormat()

Gets speech recognition output format (simple or detailed). Note: This output format is for speech recognition results, use SpeechConfig.getSpeechSynthesisOutputFormat to get synthesized audio output format.

getProperty(PropertyId id)

Gets the property by propertyId. Added in version 1.3.0.

getProperty(String name)

Gets a named property as value.

getSpeechRecognitionLanguage()

Gets the speech recognition language

getSpeechSynthesisLanguage()

Gets the speech synthesis language. Added in version 1.7.0

getSpeechSynthesisVoiceName()

Gets the speech synthesis voice name. Added in version 1.7.0

requestWordLevelTimestamps()

Includes word-level timestamps. Added in version 1.5.0.

setAuthorizationToken(String value)

Sets the authorization token. Note: The caller needs to ensure that the authorization token is valid. Before the authorization token expires, the caller needs to refresh it by calling this setter with a new valid token. As configuration values are copied when creating a new recognizer, the new token value will not apply to recognizers that have already been created. For recognizers that have been created before, you need to set authorization token of the corresponding recognizer to refresh the token. Otherwise, the recognizers will encounter errors during recognition.

setEndpointId(String value)

Sets the endpoint ID of a customized speech model that is used for speech recognition.

setOutputFormat(OutputFormat format)

Sets speech recognition output format (simple or detailed). Note: This output format is for speech recognition results, use SpeechConfig.setSpeechSynthesisOutputFormat to set synthesized audio output format.

setProfanity(ProfanityOption profanity)

Sets profanity option. Added in version 1.5.0.

setProperty(PropertyId id, String value)

Sets the property by propertyId. Added in version 1.3.0.

setProperty(String name, String value)

Sets a named property as value.

setProxy(String proxyHostName, int proxyPort, String proxyUserName, String proxyPassword)

Sets proxy configuration Added in version 1.1.0. Note: Proxy functionality is not available on macOS. This function will have no effect on this platform.

setServiceProperty(String name, String value, ServicePropertyChannel channel)

Sets a property value that will be passed to service using the specified channel. Added in version 1.5.0.

setSpeechRecognitionLanguage(String value)

Sets the speech recognition language

setSpeechSynthesisLanguage(String value)

Sets the speech synthesis language. Added in version 1.7.0

setSpeechSynthesisOutputFormat(SpeechSynthesisOutputFormat value)

Sets the speech synthesis output format. Added in version 1.7.0

setSpeechSynthesisVoiceName(String value)

Sets the speech synthesis voice name. Added in version 1.7.0

Applies to