cmd-dev / tts_azure

Package that interacts with the Azure Cognitive Services REST API to convert text to speech.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Speech to text from Azure.

image alt image alt

A Flutter package to use Text to Speech from Azure.

Package that interacts with the Azure Cognitive Services REST API to convert text to speech.

Getting Started

  1. Create an account and subscribe in Azure
  2. Add the Cognitive Services resource and get the endpoint (with region identifier) and subscription key (create resource group if necessary).
  3. Install tts_azure package.

Usage

Complete Example

There is a very simple example project in the example folder. Check it out. Otherwise, keep reading to get up and running.

Install

To use this package, add tts_azure as a dependency in your pubspec.yaml file

Setting up

First, you must define a new TTS Azure object by initializing it and passing it the required parameters as such:

final ttsazure = TTSAzure("YOUR_SUBSCRIPTION_ID", "YOUR_REGION_IDENTIFIER");

Convert Text ➡️ Speech

Finally, the only thing left to do is call the play() method to convert the text to speech, in this way:

String text = "Hello World";
String lang = "en-US";
String shortName = "BenjaminRUS"; // The voice.

ttsazure.play(text, lang, shortName);

NOTE: The Azure API allows you to use the authentication token (automatically obeyed by this package) only for 10 minutes, so this package updates the token in a minimum time of 9 minutes.

Author: @leonus96

*List of standart voices

Locale Language Gender Full service name mapping Short name
1ar-EG Arabic (Egypt) Female "Microsoft Server Speech Text to Speech Voice (ar-EG, Hoda)" "ar-EG-Hoda"
ar-SA Arabic (Saudi Arabia) Male "Microsoft Server Speech Text to Speech Voice (ar-SA, Naayf)" "ar-SA-Naayf"
bg-BG Bulgarian Male "Microsoft Server Speech Text to Speech Voice (bg-BG, Ivan)" "bg-BG-Ivan"
ca-ES Catalan (Spain) Female "Microsoft Server Speech Text to Speech Voice (ca-ES, HerenaRUS)" "ca-ES-HerenaRUS"
cs-CZ Czech Male "Microsoft Server Speech Text to Speech Voice (cs-CZ, Jakub)" "cs-CZ-Jakub"
da-DK Danish Female "Microsoft Server Speech Text to Speech Voice (da-DK, HelleRUS)" "da-DK-HelleRUS"
de-AT German (Austria) Male "Microsoft Server Speech Text to Speech Voice (de-AT, Michael)" "de-AT-Michael"
de-CH German (Switzerland) Male "Microsoft Server Speech Text to Speech Voice (de-CH, Karsten)" "de-CH-Karsten"
de-DE German (Germany) Female "Microsoft Server Speech Text to Speech Voice (de-DE, Hedda)" "de-DE-Hedda"
Female "Microsoft Server Speech Text to Speech Voice (de-DE, HeddaRUS)" "de-DE-HeddaRUS"
Male "Microsoft Server Speech Text to Speech Voice (de-DE, Stefan, Apollo)" "de-DE-Stefan-Apollo"
el-GR Greek Male "Microsoft Server Speech Text to Speech Voice (el-GR, Stefanos)" "el-GR-Stefanos"
en-AU English (Australia) Female "Microsoft Server Speech Text to Speech Voice (en-AU, Catherine)" "en-AU-Catherine"
Female "Microsoft Server Speech Text to Speech Voice (en-AU, HayleyRUS)" "en-AU-HayleyRUS"
en-CA English (Canada) Female "Microsoft Server Speech Text to Speech Voice (en-CA, Linda)" "en-CA-Linda"
Female "Microsoft Server Speech Text to Speech Voice (en-CA, HeatherRUS)" "en-CA-HeatherRUS"
en-GB English (UK) Female "Microsoft Server Speech Text to Speech Voice (en-GB, Susan, Apollo)" "en-GB-Susan-Apollo"
Female "Microsoft Server Speech Text to Speech Voice (en-GB, HazelRUS)" "en-GB-HazelRUS"
Male "Microsoft Server Speech Text to Speech Voice (en-GB, George, Apollo)" "en-GB-George-Apollo"
en-IE English (Ireland) Male "Microsoft Server Speech Text to Speech Voice (en-IE, Sean)" "en-IE-Sean"
en-IN English (India) Female "Microsoft Server Speech Text to Speech Voice (en-IN, Heera, Apollo)" "en-IN-Heera-Apollo"
Female "Microsoft Server Speech Text to Speech Voice (en-IN, PriyaRUS)" "en-IN-PriyaRUS"
Male "Microsoft Server Speech Text to Speech Voice (en-IN, Ravi, Apollo)" "en-IN-Ravi-Apollo"
en-US English (US) Female "Microsoft Server Speech Text to Speech Voice (en-US, ZiraRUS)" "en-US-ZiraRUS"
Female "Microsoft Server Speech Text to Speech Voice (en-US, AriaRUS)" "en-US-AriaRUS"
Male "Microsoft Server Speech Text to Speech Voice (en-US, BenjaminRUS)" "en-US-BenjaminRUS"
Male "Microsoft Server Speech Text to Speech Voice (en-US, Guy24kRUS)" "en-US-Guy24kRUS"
es-ES Spanish (Spain) Female "Microsoft Server Speech Text to Speech Voice (es-ES, Laura, Apollo)" "es-ES-Laura-Apollo"
Female "Microsoft Server Speech Text to Speech Voice (es-ES, HelenaRUS)" "es-ES-HelenaRUS"
Male "Microsoft Server Speech Text to Speech Voice (es-ES, Pablo, Apollo)" "es-ES-Pablo-Apollo"
es-MX Spanish (Mexico) Female "Microsoft Server Speech Text to Speech Voice (es-MX, HildaRUS)" "es-MX-HildaRUS"
Male "Microsoft Server Speech Text to Speech Voice (es-MX, Raul, Apollo)" "es-MX-Raul-Apollo"
fi-FI Finnish Female "Microsoft Server Speech Text to Speech Voice (fi-FI, HeidiRUS)" "fi-FI-HeidiRUS"
fr-CA French (Canada) Female "Microsoft Server Speech Text to Speech Voice (fr-CA, Caroline)" "fr-CA-Caroline"
Female "Microsoft Server Speech Text to Speech Voice (fr-CA, HarmonieRUS)" "fr-CA-HarmonieRUS"
fr-CH French (Switzerland) Male "Microsoft Server Speech Text to Speech Voice (fr-CH, Guillaume)" "fr-CH-Guillaume"
fr-FR French (France) Female "Microsoft Server Speech Text to Speech Voice (fr-FR, Julie, Apollo)" "fr-FR-Julie-Apollo"
Female "Microsoft Server Speech Text to Speech Voice (fr-FR, HortenseRUS)" "fr-FR-HortenseRUS"
Male "Microsoft Server Speech Text to Speech Voice (fr-FR, Paul, Apollo)" "fr-FR-Paul-Apollo"
he-IL Hebrew (Israel) Male "Microsoft Server Speech Text to Speech Voice (he-IL, Asaf)" "he-IL-Asaf"
hi-IN Hindi (India) Female "Microsoft Server Speech Text to Speech Voice (hi-IN, Kalpana, Apollo)" "hi-IN-Kalpana-Apollo"
Female "Microsoft Server Speech Text to Speech Voice (hi-IN, Kalpana)" "hi-IN-Kalpana"
Male "Microsoft Server Speech Text to Speech Voice (hi-IN, Hemant)" "hi-IN-Hemant"
hr-HR Croatian Male "Microsoft Server Speech Text to Speech Voice (hr-HR, Matej)" "hr-HR-Matej"
hu-HU Hungarian Male "Microsoft Server Speech Text to Speech Voice (hu-HU, Szabolcs)" "hu-HU-Szabolcs"
id-ID Indonesian Male "Microsoft Server Speech Text to Speech Voice (id-ID, Andika)" "id-ID-Andika"
it-IT Italian Male "Microsoft Server Speech Text to Speech Voice (it-IT, Cosimo, Apollo)" "it-IT-Cosimo-Apollo"
Female "Microsoft Server Speech Text to Speech Voice (it-IT, LuciaRUS)" "it-IT-LuciaRUS"
ja-JP Japanese Female "Microsoft Server Speech Text to Speech Voice (ja-JP, Ayumi, Apollo)" "ja-JP-Ayumi-Apollo"
Male "Microsoft Server Speech Text to Speech Voice (ja-JP, Ichiro, Apollo)" "ja-JP-Ichiro-Apollo"
Female "Microsoft Server Speech Text to Speech Voice (ja-JP, HarukaRUS)" "ja-JP-HarukaRUS"
ko-KR Korean Female "Microsoft Server Speech Text to Speech Voice (ko-KR, HeamiRUS)" "ko-KR-HeamiRUS"
ms-MY Malay Male "Microsoft Server Speech Text to Speech Voice (ms-MY, Rizwan)" "ms-MY-Rizwan"
nb-NO Norwegian Female "Microsoft Server Speech Text to Speech Voice (nb-NO, HuldaRUS)" "nb-NO-HuldaRUS"
nl-NL Dutch Female "Microsoft Server Speech Text to Speech Voice (nl-NL, HannaRUS)" "nl-NL-HannaRUS"
pl-PL Polish Female "Microsoft Server Speech Text to Speech Voice (pl-PL, PaulinaRUS)" "pl-PL-PaulinaRUS"
pt-BR Portuguese (Brazil) Female "Microsoft Server Speech Text to Speech Voice (pt-BR, HeloisaRUS)" "pt-BR-HeloisaRUS"
Male "Microsoft Server Speech Text to Speech Voice (pt-BR, Daniel, Apollo)" "pt-BR-Daniel-Apollo"
pt-PT Portuguese (Portugal) Female "Microsoft Server Speech Text to Speech Voice (pt-PT, HeliaRUS)" "pt-PT-HeliaRUS"
ro-RO Romanian Male "Microsoft Server Speech Text to Speech Voice (ro-RO, Andrei)" "ro-RO-Andrei"
ru-RU Russian Female "Microsoft Server Speech Text to Speech Voice (ru-RU, Irina, Apollo)" "ru-RU-Irina-Apollo"
Male "Microsoft Server Speech Text to Speech Voice (ru-RU, Pavel, Apollo)" "ru-RU-Pavel-Apollo"
Female "Microsoft Server Speech Text to Speech Voice (ru-RU, EkaterinaRUS)" ru-RU-EkaterinaRUS
sk-SK Slovak Male "Microsoft Server Speech Text to Speech Voice (sk-SK, Filip)" "sk-SK-Filip"
sl-SI Slovenian Male "Microsoft Server Speech Text to Speech Voice (sl-SI, Lado)" "sl-SI-Lado"
sv-SE Swedish Female "Microsoft Server Speech Text to Speech Voice (sv-SE, HedvigRUS)" "sv-SE-HedvigRUS"
ta-IN Tamil (India) Male "Microsoft Server Speech Text to Speech Voice (ta-IN, Valluvar)" "ta-IN-Valluvar"
te-IN Telugu (India) Female "Microsoft Server Speech Text to Speech Voice (te-IN, Chitra)" "te-IN-Chitra"
th-TH Thai Male "Microsoft Server Speech Text to Speech Voice (th-TH, Pattara)" "th-TH-Pattara"
tr-TR Turkish (Turkey) Female "Microsoft Server Speech Text to Speech Voice (tr-TR, SedaRUS)" "tr-TR-SedaRUS"
vi-VN Vietnamese Male "Microsoft Server Speech Text to Speech Voice (vi-VN, An)" "vi-VN-An"
zh-CN Chinese (Mandarin, simplified) Female "Microsoft Server Speech Text to Speech Voice (zh-CN, HuihuiRUS)" "zh-CN-HuihuiRUS"
Female "Microsoft Server Speech Text to Speech Voice (zh-CN, Yaoyao, Apollo)" "zh-CN-Yaoyao-Apollo"
Male "Microsoft Server Speech Text to Speech Voice (zh-CN, Kangkang, Apollo)" "zh-CN-Kangkang-Apollo"
zh-HK Chinese (Cantonese, Traditional) Female "Microsoft Server Speech Text to Speech Voice (zh-HK, Tracy, Apollo)" "zh-HK-Tracy-Apollo"
Female "Microsoft Server Speech Text to Speech Voice (zh-HK, TracyRUS)" "zh-HK-TracyRUS"
Male "Microsoft Server Speech Text to Speech Voice (zh-HK, Danny, Apollo)" "zh-HK-Danny-Apollo"
zh-TW Chinese (Taiwanese Mandarin) Female "Microsoft Server Speech Text to Speech Voice (zh-TW, Yating, Apollo)" "zh-TW-Yating-Apollo"
Female "Microsoft Server Speech Text to Speech Voice (zh-TW, HanHanRUS)" "zh-TW-HanHanRUS"
Male "Microsoft Server Speech Text to Speech Voice (zh-TW, Zhiwei, Apollo)" "zh-TW-Zhiwei-Apollo"

About

Package that interacts with the Azure Cognitive Services REST API to convert text to speech.

License:MIT License


Languages

Language:Dart 51.2%Language:Ruby 39.1%Language:Kotlin 4.7%Language:Swift 4.6%Language:Objective-C 0.4%