SpeechTranslationConfig class
Speech translation configuration.
- Extends
Properties
authorization |
Gets/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. |
endpoint |
Gets the endpoint ID of a customized speech model that is used for speech recognition. |
output |
Gets speech recognition output format (simple or detailed). Note: This output format is for speech recognition result, use [SpeechConfig.speechSynthesisOutputFormat] to get synthesized audio output format. |
region | |
speech |
Gets/Sets the speech recognition language. |
speech |
Gets the language of the speech synthesizer. Added in version 1.11.0. |
speech |
Gets the speech synthesis output format. Added in version 1.11.0. |
speech |
Gets the voice of the speech synthesizer. Added in version 1.11.0. |
subscription |
|
target |
Gets the (text) target language to translate into. |
voice |
Gets the selected voice name. |
Methods
add |
Add a (text) target language to translate into. |
close() | Dispose of associated resources. |
from |
Static instance of SpeechTranslationConfig returned by passing 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 setting the property authorizationToken with a new valid token. Otherwise, all the recognizers created by this SpeechTranslationConfig instance will encounter errors during recognition. 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. |
from |
Creates an instance of the speech translation config with specified endpoint and subscription key. This method is intended only for users who use a non-standard service endpoint or paramters. Note: The query properties specified in the endpoint URL are not changed, even if they are set by any other APIs. For example, if language is defined in the uri as query parameter "language=de-DE", and also set by the speechRecognitionLanguage property, the language setting in uri takes precedence, and the effective language is "de-DE". Only the properties that are not specified in the endpoint URL can be set by other APIs. Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the fromEndpoint method, and then set authorizationToken="token" on the created SpeechConfig instance to use the authorization token. |
from |
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(URL), and then set the AuthorizationToken property on the created SpeechConfig instance. Note: Added in version 1.9.0. |
from |
Static instance of SpeechTranslationConfig returned by passing a subscription key and service region. |
set |
Sets a named property as value |
Inherited Methods
enable |
Enable audio logging in service. Audio and content logs are stored either in Microsoft-owned storage, or in your own storage account linked to your Cognitive Services subscription (Bring Your Own Storage (BYOS) enabled Speech resource). The logs will be removed after 30 days. Added in version 1.7.0. |
enable |
Enable dictation. Only supported in speech continuous recognition. Added in version 1.7.0. |
get |
Returns the current value of an arbitrary property. |
request |
Includes word-level timestamps. Added in version 1.7.0. |
set |
Sets profanity option. Added in version 1.7.0. |
set |
Sets the proxy configuration. Only relevant in Node.js environments. Added in version 1.4.0. |
set |
Sets the proxy configuration. Only relevant in Node.js environments. Added in version 1.4.0. |
set |
Sets a property value that will be passed to service using the specified channel. Added in version 1.7.0. |
Property Details
authorizationToken
Gets/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.
void authorizationToken
Property Value
void
endpointId
Gets the endpoint ID of a customized speech model that is used for speech recognition.
string endpointId
Property Value
string
The endpoint ID
outputFormat
Gets speech recognition output format (simple or detailed). Note: This output format is for speech recognition result, use [SpeechConfig.speechSynthesisOutputFormat] to get synthesized audio output format.
OutputFormat outputFormat
Property Value
Returns the output format.
region
string region
Property Value
string
The region set on the config.
speechRecognitionLanguage
Gets/Sets the speech recognition language.
void speechRecognitionLanguage
Property Value
void
speechSynthesisLanguage
Gets the language of the speech synthesizer. Added in version 1.11.0.
string speechSynthesisLanguage
Property Value
string
Returns the speech synthesis language.
speechSynthesisOutputFormat
Gets the speech synthesis output format. Added in version 1.11.0.
SpeechSynthesisOutputFormat speechSynthesisOutputFormat
Property Value
Returns the speech synthesis output format
speechSynthesisVoiceName
Gets the voice of the speech synthesizer. Added in version 1.11.0.
string speechSynthesisVoiceName
Property Value
string
Returns the speech synthesis voice.
subscriptionKey
string subscriptionKey
Property Value
string
The subscription key set on the config.
targetLanguages
Gets the (text) target language to translate into.
string[] targetLanguages
Property Value
string[]
voiceName
Gets the selected voice name.
string voiceName
Property Value
string
The voice name.
Method Details
addTargetLanguage(string)
Add a (text) target language to translate into.
function addTargetLanguage(value: string)
Parameters
- value
-
string
The language such as de-DE
close()
Dispose of associated resources.
function close()
fromAuthorizationToken(string, string)
Static instance of SpeechTranslationConfig returned by passing 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 setting the property authorizationToken with a new valid token. Otherwise, all the recognizers created by this SpeechTranslationConfig instance will encounter errors during recognition. 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.
static function fromAuthorizationToken(authorizationToken: string, region: string): SpeechTranslationConfig
Parameters
- authorizationToken
-
string
The authorization token.
- region
-
string
The region name (see the region page).
Returns
The speech translation config.
fromEndpoint(URL, string)
Creates an instance of the speech translation config with specified endpoint and subscription key. This method is intended only for users who use a non-standard service endpoint or paramters. Note: The query properties specified in the endpoint URL are not changed, even if they are set by any other APIs. For example, if language is defined in the uri as query parameter "language=de-DE", and also set by the speechRecognitionLanguage property, the language setting in uri takes precedence, and the effective language is "de-DE". Only the properties that are not specified in the endpoint URL can be set by other APIs. Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the fromEndpoint method, and then set authorizationToken="token" on the created SpeechConfig instance to use the authorization token.
static function fromEndpoint(endpoint: URL, subscriptionKey: string): SpeechTranslationConfig
Parameters
- endpoint
-
URL
The service endpoint to connect to.
- subscriptionKey
-
string
The subscription key.
Returns
A speech config instance.
fromHost(URL, string)
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(URL), and then set the AuthorizationToken property on the created SpeechConfig instance. Note: Added in version 1.9.0.
static function fromHost(hostName: URL, subscriptionKey?: string): SpeechConfig
Parameters
- hostName
-
URL
- subscriptionKey
-
string
The subscription key. If a subscription key is not specified, an authorization token must be set.
Returns
A speech factory instance.
fromSubscription(string, string)
Static instance of SpeechTranslationConfig returned by passing a subscription key and service region.
static function fromSubscription(subscriptionKey: string, region: string): SpeechTranslationConfig
Parameters
- subscriptionKey
-
string
The subscription key.
- region
-
string
The region name (see the region page).
Returns
The speech translation config.
setProperty(string | PropertyId, string)
Sets a named property as value
function setProperty(name: string | PropertyId, value: string)
Parameters
- name
-
string | PropertyId
The name of the property to set.
- value
-
string
The new value of the property.
Inherited Method Details
enableAudioLogging()
Enable audio logging in service. Audio and content logs are stored either in Microsoft-owned storage, or in your own storage account linked to your Cognitive Services subscription (Bring Your Own Storage (BYOS) enabled Speech resource). The logs will be removed after 30 days. Added in version 1.7.0.
function enableAudioLogging()
Inherited From SpeechConfig.enableAudioLogging
enableDictation()
Enable dictation. Only supported in speech continuous recognition. Added in version 1.7.0.
function enableDictation()
Inherited From SpeechConfig.enableDictation
getProperty(string, string)
Returns the current value of an arbitrary property.
function getProperty(name: string, def?: string): string
Parameters
- name
-
string
The name of the property to query.
- def
-
string
The value to return in case the property is not known.
Returns
string
The current value, or provided default, of the given property.
Inherited From SpeechConfig.getProperty
requestWordLevelTimestamps()
Includes word-level timestamps. Added in version 1.7.0.
function requestWordLevelTimestamps()
Inherited From SpeechConfig.requestWordLevelTimestamps
setProfanity(ProfanityOption)
Sets profanity option. Added in version 1.7.0.
function setProfanity(profanity: ProfanityOption)
Parameters
- profanity
- ProfanityOption
Inherited From SpeechConfig.setProfanity
setProxy(string, number)
Sets the proxy configuration. Only relevant in Node.js environments. Added in version 1.4.0.
function setProxy(proxyHostName: string, proxyPort: number)
Parameters
- proxyHostName
-
string
The host name of the proxy server.
- proxyPort
-
number
The port number of the proxy server.
Inherited From SpeechConfig.setProxy
setProxy(string, number, string, string)
Sets the proxy configuration. Only relevant in Node.js environments. Added in version 1.4.0.
function setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string)
Parameters
- proxyHostName
-
string
The host name of the proxy server, without the protocol scheme (http://)
- proxyPort
-
number
The port number of the proxy server.
- proxyUserName
-
string
The username of the proxy server.
- proxyPassword
-
string
The password of the proxy server.
Inherited From SpeechConfig.setProxy
setServiceProperty(string, string, UriQueryParameter)
Sets a property value that will be passed to service using the specified channel. Added in version 1.7.0.
function setServiceProperty(name: string, value: string, channel: UriQueryParameter)
Parameters
- name
-
string
- value
-
string
- channel
- UriQueryParameter
Inherited From SpeechConfig.setServiceProperty