UNPKG

@voice-ping/cognitive-services-speech

Version:

VoicePing Cognitive Services Speech SDK for JavaScript forked from Microsoft

1 lines 25.4 kB
{"version":3,"sources":["src/sdk/SpeechConfig.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,YAAY,EACZ,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,sBAAsB,EACtB,2BAA2B,EAC9B,MAAM,WAAW,CAAC;AAEnB;;;GAGG;AACH,8BAAsB,YAAY;IAC9B;;;OAGG;IACH,SAAS;IAET;;;;;;;;;OASG;WACW,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAYrF;;;;;;;;;;;;;;;;;;OAkBG;WACW,YAAY,CAAC,QAAQ,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,YAAY;IAYjF;;;;;;;;;;;;;;OAcG;WACW,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,YAAY;IAY7E;;;;;;;;;;;;;;;OAeG;WACW,sBAAsB,CAAC,kBAAkB,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAW9F;;;;;;OAMG;aACa,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAExE;;;;;;;;OAQG;aACa,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI;IAEtH;;;;;OAKG;IACH,aAAoB,kBAAkB,IAAI,MAAM,CAAC;IAEjD;;;;;;;;OAQG;IACH,aAAoB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE;IAEtD;;;;;OAKG;IACH,aAAoB,yBAAyB,IAAI,MAAM,CAAC;IAExD;;;;;;OAMG;IACH,aAAoB,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE;IAE7D;;;;;;;OA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Ae,GAAG,IAAI;IAI9C,kBAAkB,IAAI,IAAI;IAG1B,0BAA0B,IAAI,IAAI;IAGlC,eAAe,IAAI,IAAI;IAIvB,KAAK,IAAI,gBAAgB;IAMhC,IAAW,uBAAuB,IAAI,MAAM,CAE3C;IAED,IAAW,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAElD;IAED,IAAW,wBAAwB,IAAI,MAAM,CAE5C;IAED,IAAW,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAEhD;IAED,IAAW,2BAA2B,IAAI,2BAA2B,CAEpE;IAED,IAAW,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,EAEzE;CACJ","file":"SpeechConfig.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport {\n ForceDictationPropertyName,\n OutputFormatPropertyName,\n ServicePropertiesPropertyName\n} from \"../common.speech/Exports\";\nimport {IStringDictionary} from \"../common/Exports\";\nimport {Contracts} from \"./Contracts\";\nimport {\n OutputFormat,\n ProfanityOption,\n PropertyCollection,\n PropertyId,\n ServicePropertyChannel,\n SpeechSynthesisOutputFormat,\n} from \"./Exports\";\n\n/**\n * Speech configuration.\n * @class SpeechConfig\n */\nexport abstract class SpeechConfig {\n /**\n * Creates and initializes an instance.\n * @constructor\n */\n protected constructor() { }\n\n /**\n * Static instance of SpeechConfig returned by passing subscriptionKey and service region.\n * Note: Please use your LanguageUnderstanding subscription key in case you want to use the Intent recognizer.\n * @member SpeechConfig.fromSubscription\n * @function\n * @public\n * @param {string} subscriptionKey - The subscription key.\n * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\n * @returns {SpeechConfig} The speech factory\n */\n public static fromSubscription(subscriptionKey: string, region: string): SpeechConfig {\n Contracts.throwIfNullOrWhitespace(subscriptionKey, \"subscriptionKey\");\n Contracts.throwIfNullOrWhitespace(region, \"region\");\n\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_IntentRegion, region);\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n\n return speechImpl;\n }\n\n /**\n * Creates an instance of the speech config with specified endpoint and subscription key.\n * This method is intended only for users who use a non-standard service endpoint or parameters.\n * Note: Please use your LanguageUnderstanding subscription key in case you want to use the Intent recognizer.\n * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\n * For example, if language is defined in the uri as query parameter \"language=de-DE\", and also set by\n * SpeechConfig.speechRecognitionLanguage = \"en-US\", the language setting in uri takes precedence,\n * and the effective language is \"de-DE\". Only the parameters that are not specified in the\n * endpoint URL can be set by other APIs.\n * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\n * fromEndpoint method, and then set authorizationToken=\"token\" on the created SpeechConfig instance to\n * use the authorization token.\n * @member SpeechConfig.fromEndpoint\n * @function\n * @public\n * @param {URL} endpoint - The service endpoint to connect to.\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\n * @returns {SpeechConfig} A speech factory instance.\n */\n public static fromEndpoint(endpoint: URL, subscriptionKey?: string): SpeechConfig {\n Contracts.throwIfNull(endpoint, \"endpoint\");\n\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Endpoint, endpoint.href);\n\n if (undefined !== subscriptionKey) {\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n }\n return speechImpl;\n }\n\n /**\n * Creates an instance of the speech config with specified host and subscription key.\n * This method is intended only for users who use a non-default service host. Standard resource path will be assumed.\n * For services with a non-standard resource path or no path at all, use fromEndpoint instead.\n * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\n * Note: To use an authorization token with fromHost, use fromHost(URL),\n * and then set the AuthorizationToken property on the created SpeechConfig instance.\n * Note: Added in version 1.9.0.\n * @member SpeechConfig.fromHost\n * @function\n * @public\n * @param {URL} host - The service endpoint to connect to. Format is \"protocol://host:port\" where \":port\" is optional.\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization token must be set.\n * @returns {SpeechConfig} A speech factory instance.\n */\n public static fromHost(hostName: URL, subscriptionKey?: string): SpeechConfig {\n Contracts.throwIfNull(hostName, \"hostName\");\n\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Host, hostName.protocol + \"//\" + hostName.hostname + (hostName.port === \"\" ? \"\" : \":\" + hostName.port));\n\n if (undefined !== subscriptionKey) {\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n }\n return speechImpl;\n }\n\n /**\n * Creates an instance of the speech factory with specified initial authorization token and region.\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\n * expires, the caller needs to refresh it by calling this setter with a new valid token.\n * Note: Please use a token derived from your LanguageUnderstanding subscription key in case you want\n * to use the Intent recognizer. As configuration values are copied when creating a new recognizer,\n * the new token value will not apply to recognizers that have already been created. For recognizers\n * that have been created before, you need to set authorization token of the corresponding recognizer\n * to refresh the token. Otherwise, the recognizers will encounter errors during recognition.\n * @member SpeechConfig.fromAuthorizationToken\n * @function\n * @public\n * @param {string} authorizationToken - The initial authorization token.\n * @param {string} region - The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\n * @returns {SpeechConfig} A speech factory instance.\n */\n public static fromAuthorizationToken(authorizationToken: string, region: string): SpeechConfig {\n Contracts.throwIfNull(authorizationToken, \"authorizationToken\");\n Contracts.throwIfNullOrWhitespace(region, \"region\");\n\n const speechImpl: SpeechConfigImpl = new SpeechConfigImpl();\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_Region, region);\n speechImpl.setProperty(PropertyId.SpeechServiceConnection_IntentRegion, region);\n speechImpl.authorizationToken = authorizationToken;\n return speechImpl;\n }\n\n /**\n * Sets the proxy configuration.\n * Only relevant in Node.js environments.\n * Added in version 1.4.0.\n * @param proxyHostName The host name of the proxy server.\n * @param proxyPort The port number of the proxy server.\n */\n public abstract setProxy(proxyHostName: string, proxyPort: number): void;\n\n /**\n * Sets the proxy configuration.\n * Only relevant in Node.js environments.\n * Added in version 1.4.0.\n * @param proxyHostName The host name of the proxy server, without the protocol scheme (http://)\n * @param proxyPort The port number of the proxy server.\n * @param proxyUserName The user name of the proxy server.\n * @param proxyPassword The password of the proxy server.\n */\n public abstract setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\n\n /**\n * Gets the authorization token.\n * @member SpeechConfig.prototype.authorizationToken\n * @function\n * @public\n */\n public abstract get authorizationToken(): string;\n\n /**\n * Gets/Sets the authorization token.\n * Note: The caller needs to ensure that the authorization token is valid. Before the authorization token\n * expires, the caller needs to refresh it by calling this setter with a new valid token.\n * @member SpeechConfig.prototype.authorizationToken\n * @function\n * @public\n * @param {string} value - The authorization token.\n */\n public abstract set authorizationToken(value: string);\n\n /**\n * Returns the configured language.\n * @member SpeechConfig.prototype.speechRecognitionLanguage\n * @function\n * @public\n */\n public abstract get speechRecognitionLanguage(): string;\n\n /**\n * Gets/Sets the input language.\n * @member SpeechConfig.prototype.speechRecognitionLanguage\n * @function\n * @public\n * @param {string} value - The authorization token.\n */\n public abstract set speechRecognitionLanguage(value: string);\n\n /**\n * Sets an arbitrary property.\n * @member SpeechConfig.prototype.setProperty\n * @function\n * @public\n * @param {string} name - The name of the property to set.\n * @param {string} value - The new value of the property.\n */\n public abstract setProperty(name: string, value: string): void;\n\n /**\n * Returns the current value of an arbitrary property.\n * @member SpeechConfig.prototype.getProperty\n * @function\n * @public\n * @param {string} name - The name of the property to query.\n * @param {string} def - The value to return in case the property is not known.\n * @returns {string} The current value, or provided default, of the given property.\n */\n public abstract getProperty(name: string, def?: string): string;\n\n /**\n * Gets speech recognition output format (simple or detailed).\n * Note: This output format is for speech recognition result, use [SpeechConfig.speechSynthesisOutputFormat] to\n * get synthesized audio output format.\n * @member SpeechConfig.prototype.outputFormat\n * @function\n * @public\n * @returns {OutputFormat} Returns the output format.\n */\n public abstract get outputFormat(): OutputFormat;\n\n /**\n * Gets/Sets speech recognition output format (simple or detailed).\n * Note: This output format is for speech recognition result, use [SpeechConfig.speechSynthesisOutputFormat] to\n * set synthesized audio output format.\n * @member SpeechConfig.prototype.outputFormat\n * @function\n * @public\n */\n public abstract set outputFormat(format: OutputFormat);\n\n /**\n * Gets the endpoint ID of a customized speech model that is used for speech recognition.\n * @member SpeechConfig.prototype.endpointId\n * @function\n * @public\n * @return {string} The endpoint ID\n */\n public abstract get endpointId(): string;\n\n /**\n * Gets/Sets the endpoint ID of a customized speech model that is used for speech recognition.\n * @member SpeechConfig.prototype.endpointId\n * @function\n * @public\n * @param {string} value - The endpoint ID\n */\n public abstract set endpointId(value: string);\n\n /**\n * Closes the configuration.\n * @member SpeechConfig.prototype.close\n * @function\n * @public\n */\n /* tslint:disable:no-empty */\n public close(): void { }\n\n /**\n * @member SpeechConfig.prototype.subscriptionKey\n * @function\n * @public\n * @return {string} The subscription key set on the config.\n */\n public abstract get subscriptionKey(): string;\n\n /**\n * @member SpeechConfig.prototype.region\n * @function\n * @public\n * @return {region} The region set on the config.\n */\n public abstract get region(): string;\n\n /**\n * @member SpeechConfig.prototype.setServiceProperty\n * @function\n * @public\n * @param {name} The name of the property.\n * @param {value} Value to set.\n * @param {channel} The channel used to pass the specified property to service.\n * @summary Sets a property value that will be passed to service using the specified channel.\n * Added in version 1.7.0.\n */\n public abstract setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void;\n\n /**\n * @member SpeechConfig.prototype.setProfanity\n * @function\n * @public\n * @param {profanity} Profanity option to set.\n * @summary Sets profanity option.\n * Added in version 1.7.0.\n */\n public abstract setProfanity(profanity: ProfanityOption): void;\n\n /**\n * @member SpeechConfig.prototype.enableAudioLogging\n * @function\n * @public\n * @summary Enable audio logging in service.\n * Added in version 1.7.0.\n */\n public abstract enableAudioLogging(): void;\n\n /**\n * @member SpeechConfig.prototype.requestWordLevelTimestamps\n * @function\n * @public\n * @summary Includes word-level timestamps.\n * Added in version 1.7.0.\n */\n public abstract requestWordLevelTimestamps(): void;\n\n /**\n * @member SpeechConfig.prototype.enableDictation\n * @function\n * @public\n * @summary Enable dictation. Only supported in speech continuous recognition.\n * Added in version 1.7.0.\n */\n public abstract enableDictation(): void;\n\n /**\n * Gets the language of the speech synthesizer.\n * @member SpeechConfig.prototype.speechSynthesisLanguage\n * @function\n * @public\n * @returns {string} Returns the speech synthesis language.\n * Added in version 1.11.0.\n */\n public abstract get speechSynthesisLanguage(): string;\n\n /**\n * Sets the language of the speech synthesizer.\n * @member SpeechConfig.prototype.speechSynthesisLanguage\n * @function\n * @public\n * Added in version 1.11.0.\n */\n public abstract set speechSynthesisLanguage(language: string);\n\n /**\n * Gets the voice of the speech synthesizer.\n * @member SpeechConfig.prototype.speechSynthesisVoiceName\n * @function\n * @public\n * @returns {string} Returns the speech synthesis voice.\n * Added in version 1.11.0.\n */\n public abstract get speechSynthesisVoiceName(): string;\n\n /**\n * Sets the voice of the speech synthesizer. (see <a href=\"https://aka.ms/speech/tts-languages\">available voices</a>).\n * @member SpeechConfig.prototype.speechSynthesisVoiceName\n * @function\n * @public\n * Added in version 1.11.0.\n */\n public abstract set speechSynthesisVoiceName(voice: string);\n\n /**\n * Gets the speech synthesis output format.\n * @member SpeechConfig.prototype.speechSynthesisOutputFormat\n * @function\n * @public\n * @returns {SpeechSynthesisOutputFormat} Returns the speech synthesis output format\n * Added in version 1.11.0.\n */\n public abstract get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat;\n\n /**\n * Sets the speech synthesis output format (e.g. Riff16Khz16BitMonoPcm).\n * @member SpeechConfig.prototype.speechSynthesisOutputFormat\n * @function\n * @public\n * The default format is Audio16Khz64KBitRateMonoMp3 for browser and Riff16Khz16BitMonoPcm for Node.JS\n * Added in version 1.11.0.\n */\n public abstract set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat);\n}\n\n/**\n * @public\n * @class SpeechConfigImpl\n */\n// tslint:disable-next-line:max-classes-per-file\nexport class SpeechConfigImpl extends SpeechConfig {\n\n private privProperties: PropertyCollection;\n\n public constructor() {\n super();\n this.privProperties = new PropertyCollection();\n this.speechRecognitionLanguage = \"en-US\"; // Should we have a default?\n this.outputFormat = OutputFormat.Simple;\n }\n\n public get properties(): PropertyCollection {\n return this.privProperties;\n }\n\n public get endPoint(): URL {\n return new URL(this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Endpoint));\n }\n\n public get subscriptionKey(): string {\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Key);\n }\n\n public get region(): string {\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_Region);\n }\n\n public get authorizationToken(): string {\n return this.privProperties.getProperty(PropertyId.SpeechServiceAuthorization_Token);\n }\n\n public set authorizationToken(value: string) {\n this.privProperties.setProperty(PropertyId.SpeechServiceAuthorization_Token, value);\n }\n\n public get speechRecognitionLanguage(): string {\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_RecoLanguage);\n }\n\n public set speechRecognitionLanguage(value: string) {\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_RecoLanguage, value);\n }\n\n public get autoDetectSourceLanguages(): string {\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages);\n }\n\n public set autoDetectSourceLanguages(value: string) {\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_AutoDetectSourceLanguages, value);\n }\n\n public get outputFormat(): OutputFormat {\n return (OutputFormat as any)[this.privProperties.getProperty(OutputFormatPropertyName, undefined)];\n }\n\n public set outputFormat(value: OutputFormat) {\n this.privProperties.setProperty(OutputFormatPropertyName, OutputFormat[value]);\n }\n\n public get endpointId(): string {\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_EndpointId);\n }\n\n public set endpointId(value: string) {\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_EndpointId, value);\n }\n\n public setProperty(name: string | PropertyId, value: string): void {\n Contracts.throwIfNull(value, \"value\");\n\n this.privProperties.setProperty(name, value);\n }\n\n public getProperty(name: string | PropertyId, def?: string): string {\n\n return this.privProperties.getProperty(name, def);\n }\n\n public setProxy(proxyHostName: string, proxyPort: number): void;\n public setProxy(proxyHostName: string, proxyPort: number, proxyUserName: string, proxyPassword: string): void;\n public setProxy(proxyHostName: any, proxyPort: any, proxyUserName?: any, proxyPassword?: any): void {\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyHostName], proxyHostName);\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPort], proxyPort);\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyUserName], proxyUserName);\n this.setProperty(PropertyId[PropertyId.SpeechServiceConnection_ProxyPassword], proxyPassword);\n }\n\n public setServiceProperty(name: string, value: string, channel: ServicePropertyChannel): void {\n const currentProperties: IStringDictionary<string> = JSON.parse(this.privProperties.getProperty(ServicePropertiesPropertyName, \"{}\"));\n\n currentProperties[name] = value;\n\n this.privProperties.setProperty(ServicePropertiesPropertyName, JSON.stringify(currentProperties));\n }\n\n public setProfanity(profanity: ProfanityOption): void {\n this.privProperties.setProperty(PropertyId.SpeechServiceResponse_ProfanityOption, ProfanityOption[profanity]);\n }\n\n public enableAudioLogging(): void {\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_EnableAudioLogging, \"true\");\n }\n public requestWordLevelTimestamps(): void {\n this.privProperties.setProperty(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, \"true\");\n }\n public enableDictation(): void {\n this.privProperties.setProperty(ForceDictationPropertyName, \"true\");\n }\n\n public clone(): SpeechConfigImpl {\n const ret: SpeechConfigImpl = new SpeechConfigImpl();\n ret.privProperties = this.privProperties.clone();\n return ret;\n }\n\n public get speechSynthesisLanguage(): string {\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthLanguage);\n }\n\n public set speechSynthesisLanguage(language: string) {\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthLanguage, language);\n }\n\n public get speechSynthesisVoiceName(): string {\n return this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthVoice);\n }\n\n public set speechSynthesisVoiceName(voice: string) {\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthVoice, voice);\n }\n\n public get speechSynthesisOutputFormat(): SpeechSynthesisOutputFormat {\n return (SpeechSynthesisOutputFormat as any)[this.privProperties.getProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, undefined)];\n }\n\n public set speechSynthesisOutputFormat(format: SpeechSynthesisOutputFormat) {\n this.privProperties.setProperty(PropertyId.SpeechServiceConnection_SynthOutputFormat, SpeechSynthesisOutputFormat[format]);\n }\n}\n"]}