tts_azure 0.0.5 tts_azure: ^0.0.5 copied to clipboard
Text to Speech from Azure. A Flutter package that interacts with the Azure Cognitive Services REST API to convert text to speech.
Speech to text from Azure. #
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 #
- Create an account and subscribe in Azure
- Add subscription.
- Add the Cognitive Services resource and get the endpoint and subscription key
- 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.
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