IBM Watson Text to Speech (Independent Publisher) (#2365)

* Custom connector

* Added descriptions

* Updated responses

* Added contact info

* Fixed category

* Added requirements

* Fixed swagger
This commit is contained in:
Lucas Titus 2023-02-15 21:04:54 +00:00 коммит произвёл GitHub
Родитель 57aa829cd4
Коммит a9a0816a7e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 488 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,361 @@
{
"swagger": "2.0",
"info": {
"title": "IBM Watson Text to Speech",
"description": "The IBM Watson Text to Speech service uses IBM's speech-synthesis capabilities to synthesize text into natural-sounding speech in a variety of languages, dialects, and voices.",
"version": "1.0",
"contact": {
"name": "Lucas Titus",
"url": "https://uk.linkedin.com/in/lucas-titus-a59541176",
"email": "lucas.titus.21@ucl.ac.uk"
}
},
"x-ms-connector-metadata": [
{
"propertyName": "Website",
"propertyValue": "https://cloud.ibm.com/"
},
{
"propertyName": "Privacy policy",
"propertyValue": "https://www.ibm.com/us-en/privacy"
},
{
"propertyName": "Categories",
"propertyValue": "AI"
}
],
"host": "text-to-speech.watson.cloud.ibm.com",
"basePath": "/",
"schemes": [
"https"
],
"consumes": [],
"produces": [],
"paths": {
"/v1/synthesize": {
"post": {
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"properties": {
"base64": {
"type": "string",
"description": "base64"
}
}
}
}
},
"summary": "Synthesize",
"parameters": [
{
"name": "voice",
"in": "query",
"x-ms-summary": "Voice Name",
"required": false,
"type": "string",
"default": "en-US_MichaelV3Voice",
"description": "Voice Name",
"enum": [
"ar-MS_OmarVoice",
"cs-CZ_AlenaVoice",
"de-DE_BirgitV3Voice",
"de-DE_DieterV3Voice",
"de-DE_ErikaV3Voice",
"en-AU_CraigVoice",
"en-AU_MadisonVoice",
"en-AU_SteveVoice",
"en-GB_CharlotteV3Voice",
"en-GB_JamesV3Voice",
"en-GB_KateV3Voice",
"en-US_AllisonExpressive",
"en-US_AllisonV3Voice",
"en-US_EmilyV3Voice",
"en-US_EmmaExpressive",
"en-US_HenryV3Voice",
"en-US_KevinV3Voice",
"en-US_LisaExpressive",
"en-US_LisaV3Voice",
"en-US_MichaelExpressive",
"en-US_MichaelV3Voice",
"en-US_OliviaV3Voice",
"es-ES_EnriqueV3Voice",
"es-ES_LauraV3Voice",
"es-LA_SofiaV3Voice",
"es-US_SofiaV3Voice",
"fr-CA_LouiseV3Voice",
"fr-FR_NicolasV3Voice",
"fr-FR_ReneeV3Voice",
"it-IT_FrancescaV3Voice",
"ja-JP_EmiV3Voice",
"ko-KR_HyunjunVoice",
"ko-KR_SiWooVoice",
"ko-KR_YoungmiVoice",
"ko-KR_YunaVoice",
"nl-BE_AdeleVoice",
"nl-BE_BramVoice",
"nl-NL_EmmaVoice",
"nl-NL_LiamVoice",
"pt-BR_IsabelaV3Voice",
"sv-SE_IngridVoice",
"zh-CN_LiNaVoice",
"zh-CN_WangWeiVoice",
"zh-CN_ZhangJingVoice"
]
},
{
"name": "body",
"in": "body",
"x-ms-summary": "Text",
"required": false,
"schema": {
"type": "object",
"properties": {
"text": {
"type": "string",
"description": "Text to convert to speech",
"title": "Text"
}
},
"required": [
"text"
]
}
}
],
"description": "Synthesizes text to audio that is spoken in the specified voice.",
"operationId": "Synthesize"
}
},
"/v1/voices": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"properties": {
"voices": {
"type": "array",
"items": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "url"
},
"name": {
"type": "string",
"description": "name"
},
"language": {
"type": "string",
"description": "language"
},
"customizable": {
"type": "boolean",
"description": "customizable"
},
"gender": {
"type": "string",
"description": "gender"
},
"supported_features": {
"type": "object",
"properties": {
"voice_transformation": {
"type": "boolean",
"description": "voice_transformation"
},
"custom_pronunciation": {
"type": "boolean",
"description": "custom_pronunciation"
}
},
"description": "supported_features"
},
"description": {
"type": "string",
"description": "description"
}
}
}
}
}
}
}
},
"summary": "List Voices",
"description": "Lists all voices available for use with the service.",
"operationId": "ListVoices"
}
},
"/v1/pronunciation": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"properties": {
"pronunciation": {
"type": "string",
"description": "pronunciation"
}
}
}
}
},
"summary": "Pronunciation",
"operationId": "Pronunciation",
"description": "Gets the phonetic pronunciation for the specified word.",
"parameters": [
{
"name": "voice",
"in": "query",
"x-ms-summary": "Voice Name",
"required": false,
"type": "string",
"default": "en-US_MichaelV3Voice",
"description": "Voice Name",
"enum": [
"ar-MS_OmarVoice",
"cs-CZ_AlenaVoice",
"de-DE_BirgitV3Voice",
"de-DE_DieterV3Voice",
"de-DE_ErikaV3Voice",
"en-AU_CraigVoice",
"en-AU_MadisonVoice",
"en-AU_SteveVoice",
"en-GB_CharlotteV3Voice",
"en-GB_JamesV3Voice",
"en-GB_KateV3Voice",
"en-US_AllisonExpressive",
"en-US_AllisonV3Voice",
"en-US_EmilyV3Voice",
"en-US_EmmaExpressive",
"en-US_HenryV3Voice",
"en-US_KevinV3Voice",
"en-US_LisaExpressive",
"en-US_LisaV3Voice",
"en-US_MichaelExpressive",
"en-US_MichaelV3Voice",
"en-US_OliviaV3Voice",
"es-ES_EnriqueV3Voice",
"es-ES_LauraV3Voice",
"es-LA_SofiaV3Voice",
"es-US_SofiaV3Voice",
"fr-CA_LouiseV3Voice",
"fr-FR_NicolasV3Voice",
"fr-FR_ReneeV3Voice",
"it-IT_FrancescaV3Voice",
"ja-JP_EmiV3Voice",
"ko-KR_HyunjunVoice",
"ko-KR_SiWooVoice",
"ko-KR_YoungmiVoice",
"ko-KR_YunaVoice",
"nl-BE_AdeleVoice",
"nl-BE_BramVoice",
"nl-NL_EmmaVoice",
"nl-NL_LiamVoice",
"pt-BR_IsabelaV3Voice",
"sv-SE_IngridVoice",
"zh-CN_LiNaVoice",
"zh-CN_WangWeiVoice",
"zh-CN_ZhangJingVoice"
]
},
{
"name": "text",
"in": "query",
"x-ms-summary": "Text",
"description": "Text to pronounce",
"required": false,
"type": "string"
}
]
}
},
"/v1/voices/{voice}": {
"get": {
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "url"
},
"name": {
"type": "string",
"description": "name"
},
"language": {
"type": "string",
"description": "language"
},
"customizable": {
"type": "boolean",
"description": "customizable"
},
"gender": {
"type": "string",
"description": "gender"
},
"supported_features": {
"type": "object",
"properties": {
"voice_transformation": {
"type": "boolean",
"description": "voice_transformation"
},
"custom_pronunciation": {
"type": "boolean",
"description": "custom_pronunciation"
}
},
"description": "supported_features"
},
"description": {
"type": "string",
"description": "description"
}
}
}
}
},
"summary": "Get Voice",
"description": "Gets information about the specified voice.",
"operationId": "GetVoice",
"parameters": [
{
"name": "voice",
"in": "path",
"x-ms-summary": "Voice Name",
"description": "Voice Name",
"required": true,
"type": "string"
}
]
}
}
},
"definitions": {},
"parameters": {},
"responses": {},
"securityDefinitions": {
"basic-auth": {
"type": "basic"
}
},
"security": [
{
"basic-auth": []
}
],
"tags": []
}

Просмотреть файл

@ -0,0 +1,67 @@
{
"properties": {
"connectionParameters": {
"url": {
"type": "string",
"uiDefinition": {
"displayName": "Service URL",
"description": "The service URL",
"tooltip": "Provide your service URL",
"constraints": {
"tabIndex": 1,
"clearText": false,
"required": "true"
}
}
},
"username": {
"type": "string",
"uiDefinition": {
"displayName": "API Key Name",
"description": "The API key name",
"tooltip": "Provide the username",
"constraints": {
"tabIndex": 2,
"clearText": false,
"required": "true",
"allowedValues": [
{
"text": "Default",
"value": "apikey"
}
]
}
}
},
"password": {
"type": "securestring",
"uiDefinition": {
"displayName": "API Key",
"description": "The service API key",
"tooltip": "Provide the API Key",
"constraints": {
"tabIndex": 3,
"clearText": false,
"required": "true"
}
}
}
},
"iconBrandColor": "#da3b01",
"scriptOperations": [
"Synthesize"
],
"capabilities": [],
"policyTemplateInstances": [
{
"templateId": "dynamichosturl",
"title": "SetHost",
"parameters": {
"x-ms-apimTemplateParameter.urlTemplate": "@connectionParameters('url')"
}
}
],
"publisher": "Lucas Titus",
"stackOwner": "IBM"
}
}

Просмотреть файл

@ -0,0 +1,39 @@
# **IBM Watson Text to Speech**
The IBM Watson™ Text to Speech service provides APIs that use IBM's speech-synthesis capabilities to synthesize text into natural-sounding speech in a variety of languages, dialects, and voices. The service supports at least one male or female voice, sometimes both, for each language. The audio is streamed back to the client with minimal delay.
### Publishers: Lucas Titus, Kin Cheung, Ivan Leong, Andrew Lau
# Pre-requisites
- A Microsoft Power Apps or Power Automate plan.
- An [IBM Cloud](https://cloud.ibm.com) account with access to Watson services.
- A provisioned [Text to Speech](https://cloud.ibm.com/catalog/services/text-to-speech) resource.
# Obtaining Credentials
Retrieve your IBM Watson Text to Speech API key and service URL from the **manage** resource page as seen in the image below.
![Credentials](https://i.gyazo.com/5e1d0845b57591a821ddf225eba38a19.png)
Copy your API key and URL and paste them in the connector connection configuration.
# Supported Operations
### [Synethesize](https://cloud.ibm.com/apidocs/text-to-speech#synthesize)
Synthesizes text to audio that is spoken in the specified voice. The service bases its understanding of the language for the input text on the specified voice. Use a voice that matches the language of the input text.
### [Get pronunciation](https://cloud.ibm.com/apidocs/text-to-speech#getpronunciation)
Gets the phonetic pronunciation for the specified word. You can request the pronunciation for a specific format. You can also request the pronunciation for a specific voice to see the default translation for the language of that voice or for a specific custom model to see the translation for that model.
### [List voices](https://cloud.ibm.com/apidocs/text-to-speech#listvoices)
Lists all voices available for use with the service. The information includes the name, language, gender, and other details about the voice. The ordering of the list of voices can change from call to call; do not rely on an alphabetized or static list of voices. To see information about a specific voice, use the Get a voice.
### [Get a voice](https://cloud.ibm.com/apidocs/text-to-speech#getvoice)
Gets information about the specified voice. The information includes the name, language, gender, and other details about the voice. Specify a customization ID to obtain information for a custom model that is defined for the language of the specified voice. To list information about all available voices, use the List voices method.
# Known Issues and Limitations
Currently, the audio file from the **Synethesize** operation is returned as a base64 string to allow support in Canvas apps. This might cause issues with other services.

Просмотреть файл

@ -0,0 +1,21 @@
public class Script : ScriptBase
{
public override async Task<HttpResponseMessage> ExecuteAsync()
{
var response = await Context.SendAsync(Context.Request, CancellationToken);
if (response.IsSuccessStatusCode)
{
var bytes = await response.Content.ReadAsByteArrayAsync();
var json = new JObject
{
["base64"] = Convert.ToBase64String(bytes),
};
response.Content = CreateJsonContent(json.ToString());
}
return response;
}
}