{"id":32277975,"url":"https://github.com/markokosticdev/cloud_text_to_speech_flutter","last_synced_at":"2026-02-21T08:02:30.942Z","repository":{"id":181241839,"uuid":"666459377","full_name":"markokosticdev/cloud_text_to_speech_flutter","owner":"markokosticdev","description":"Single interface to Google, Microsoft, and Amazon Text-To-Speech.","archived":false,"fork":false,"pushed_at":"2025-06-10T08:19:46.000Z","size":138,"stargazers_count":7,"open_issues_count":6,"forks_count":14,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-10T09:29:30.464Z","etag":null,"topics":["amazon-tts","aws","azure","google-cloud","google-tts","microsoft-tts","text-to-speech","tts","universal-tts"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/cloud_text_to_speech","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/markokosticdev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"markokosticdev"}},"created_at":"2023-07-14T15:13:03.000Z","updated_at":"2025-06-10T08:19:50.000Z","dependencies_parsed_at":"2023-10-27T13:38:36.439Z","dependency_job_id":"9db43fac-c0de-4b66-a67e-64f61cf9c3ae","html_url":"https://github.com/markokosticdev/cloud_text_to_speech_flutter","commit_stats":null,"previous_names":["markokosticdev/cloud_text_to_speech","markokosticdev/cloud_text_to_speech_flutter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/markokosticdev/cloud_text_to_speech_flutter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markokosticdev%2Fcloud_text_to_speech_flutter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markokosticdev%2Fcloud_text_to_speech_flutter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markokosticdev%2Fcloud_text_to_speech_flutter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markokosticdev%2Fcloud_text_to_speech_flutter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markokosticdev","download_url":"https://codeload.github.com/markokosticdev/cloud_text_to_speech_flutter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markokosticdev%2Fcloud_text_to_speech_flutter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29676984,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T06:23:40.028Z","status":"ssl_error","status_checked_at":"2026-02-21T06:23:39.222Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-tts","aws","azure","google-cloud","google-tts","microsoft-tts","text-to-speech","tts","universal-tts"],"created_at":"2025-10-23T00:15:43.761Z","updated_at":"2026-02-21T08:02:30.937Z","avatar_url":"https://github.com/markokosticdev.png","language":"Dart","funding_links":["https://github.com/sponsors/markokosticdev","https://www.buymeacoffee.com/markokostich"],"categories":[],"sub_categories":[],"readme":"# Cloud Text-To-Speech\n\n[![Pub Version](https://img.shields.io/pub/v/cloud_text_to_speech.svg?logo=dart)](https://pub.dev/packages/cloud_text_to_speech)\n[![Pub Likes](https://img.shields.io/pub/likes/cloud_text_to_speech.svg?logo=dart)](https://pub.dev/packages/cloud_text_to_speech)\n[![Pub Popularity](https://img.shields.io/pub/popularity/cloud_text_to_speech.svg?logo=dart)](https://pub.dev/packages/cloud_text_to_speech)\n[![Pub Points](https://img.shields.io/pub/points/cloud_text_to_speech.svg?logo=dart)](https://pub.dev/packages/cloud_text_to_speech)\n[![GitHub License](https://img.shields.io/github/license/markokosticdev/cloud_text_to_speech_flutter.svg?logo=github)](https://github.com/markokosticdev/cloud_text_to_speech_flutter?tab=BSD-2-Clause-1-ov-file)\n[![GitHub Sponsor](https://img.shields.io/badge/GitHub%20Sponsor-donate-yellow.svg?logo=github)](https://github.com/sponsors/markokosticdev)\n[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20A%20Coffee-donate-yellow.svg?logo=buy-me-a-coffee)](https://www.buymeacoffee.com/markokostich)\n\nSingle interface to Google, Microsoft, and Amazon Text-To-Speech.\nFlutter implementation of:\n\n- [Google Cloud Text-To-Speech API](https://cloud.google.com/text-to-speech)\n- [Microsoft Azure Cognitive Text-To-Speech API](https://azure.microsoft.com/en-us/services/cognitive-services/text-to-speech)\n- [Amazon Polly API](https://aws.amazon.com/polly)\n\n## Features\n\n- Universal implementation for accessing all providers with one interface.\n- Separate implementation for every provider so we could access every functionality.\n- Sanitize SSML input per provider so we send only supported SSML elements.\n- Locale names in English and native language so we could display language selector.\n- Fake name generation for Google voices that are generated randomly based on voice locale.\n- Accessible configurable output format (per provider), rate, and pitch.\n\n## Feature Requests\n\nWe welcome and value your ideas and suggestions to improve this project! To submit and vote for feature requests, please visit our [Feature Requests Board](https://cloud-text-to-speech.featureupvote.com).\n\nOn the board, you can:\n- **Submit new feature requests**: Share your ideas on how we can enhance the project.\n- **Vote on existing requests**: Help prioritize the most popular features by voting for the ones you find most valuable.\n\nThank you for contributing to the development and improvement of Cloud Text-To-Speech!\n\n## Getting Started\n\nThere are essentially two ways to use Cloud Text-To-Speech:\n\n- **Universal**: Using TtsUniversal to be able to configure the TTS provider dynamically and us it.\n    - **Single**: Using `TtsProviders.google`, `TtsProviders.microsoft`, `TtsProviders.amazon` to use the single provider at a time.\n    - **Combine**: Using `TtsProviders.combine` to combine all providers and get all voices at once.\n- **Provider**: Using TtsGoogle, TtsMicrosoft, TtsAmazon to get the most from provider's API.\n\n### Universal(Single)\n\nTo init configuration use:\n\n```dart\n//Do init once and run it before any other method\nTtsUniversal.init(\n  provider: TtsProviders.amazon,\n  googleParams: InitParamsGoogle(apiKey: 'API-KEY'),\n  microsoftParams: InitParamsMicrosoft(\n  subscriptionKey: 'SUBSCRIPTION-KEY', region: 'eastus'),\n  amazonParams: InitParamsAmazon(\n  keyId: 'KEY-ID', accessKey: 'ACCESS-KEY', region: 'us-east-1'),\n  withLogs: true\n);\n```\n\nTo change provider use:\n\n```dart\nTtsUniversal.setProvider(TtsProviders.microsoft);\n```\n\nTo get the list of all voices use:\n\n```dart\n//Get voices\nfinal voicesResponse = await TtsUniversal.getVoices();\n\nfinal voices = voicesResponse.voices;\n\n//Print all available voices\nprint(voices);\n\n//Pick an English Voice\nfinal voice = voices\n    .where((element) =\u003e element.locale.code.startsWith(\"en-\"))\n    .toList(growable: false)\n    .first;\n```\n\nTo convert TTS and get audio use:\n\n```dart\n//Generate Audio for a text\nconst text = \"Amazon, Microsoft and Google Text-to-Speech API are awesome\";\n\nfinal ttsParams = TtsParamsUniversal(\n        voice: voice, \n        audioFormat: AudioOutputFormatUniversal.mp3_64k, \n        text: text, \n        rate: 'slow', //optional\n        pitch: 'default' //optional\n      );\n\nfinal ttsResponse = await TtsUniversal.convertTts(ttsParams);\n\n//Get the audio bytes.\nfinal audioBytes = ttsResponse.audio.buffer.asByteData();\n```\n\n### Universal(Combine)\n\nTo init configuration use:\n\n```dart\n//Do init once and run it before any other method\nTtsUniversal.init(\n  provider: TtsProviders.combine,\n  googleParams: InitParamsGoogle(apiKey: 'API-KEY'),\n  microsoftParams: InitParamsMicrosoft(\n  subscriptionKey: 'SUBSCRIPTION-KEY', region: 'eastus'),\n  amazonParams: InitParamsAmazon(\n  keyId: 'KEY-ID', accessKey: 'ACCESS-KEY', region: 'us-east-1'),\n  withLogs: true\n);\n```\n\nTo change provider use:\n\n```dart\nTtsUniversal.setProvider(TtsProviders.combine);\n```\n\nTo get the list of all voices use:\n\n```dart\n//Get voices\nfinal voicesResponse = await TtsUniversal.getVoices();\n\nfinal voices = voicesResponse.voices;\n\n//Print all available voices\nprint(voices);\n\n//Pick an English Voice\nfinal voice = voices\n    .where((element) =\u003e element.locale.code.startsWith(\"en-\"))\n    .toList(growable: false)\n    .first;\n```\n\nTo convert TTS and get audio use:\n\n```dart\n//Generate Audio for a text\nconst text = \"Amazon, Microsoft and Google Text-to-Speech API are awesome\";\n\nfinal ttsParams = TtsParamsUniversal(\n        voice: voice, \n        audioFormat: AudioOutputFormatUniversal.mp3_64k, \n        text: text, \n        rate: 'slow', //optional\n        pitch: 'default' //optional\n);\n\nfinal ttsResponse = await TtsUniversal.convertTts(ttsParams);\n\n//Get the audio bytes.\nfinal audioBytes = ttsResponse.audio.buffer.asByteData();\n```\n\n### Google\n\nTo init configuration use:\n\n```dart\n//Do init once and run it before any other method\nTtsGoogle.init(\n  params: InitParamsGoogle(apiKey: \"API-KEY\"), \n  withLogs:true\n);\n```\n\nTo get the list of all voices use:\n\n```dart\n//Get voices\nfinal voicesResponse = await TtsGoogle.getVoices();\n\nfinal voices = voicesResponse.voices;\n\n//Print all voices\nprint(voices);\n\n//Pick an English Voice\nfinal voice = voices\n    .where((element) =\u003e element.locale.code.startsWith(\"en-\"))\n    .toList(growable: false)\n    .first;\n```\n\nTo convert TTS and get audio use:\n\n```dart\n//Generate Audio for a text\nfinal text = '\u003cspeak\u003eGoogle\u003cbreak time=\"2s\"\u003e Speech Service Text-to-Speech API is awesome!\u003c/speak\u003e';\n\nTtsParamsGoogle ttsParams = TtsParamsGoogle(\n        voice: voice, \n        audioFormat: AudioOutputFormatGoogle.mp3, \n        text: text, \n        rate: 'slow', //optional\n        pitch: 'default' //optional\n      );\n\nfinal ttsResponse = await TtsGoogle.convertTts(ttsParams);\n\n//Get the audio bytes.\nfinal audioBytes = ttsResponse.audio.buffer.asByteData();\n```\n\n### Microsoft\n\nTo init configuration use:\n\n```dart\n//Do init once and run it before any other method\nTtsMicrosoft.init(\n  params: InitParamsMicrosoft(\n  subscriptionKey: \"SUBSCRIPTION-KEY\", region: \"eastus\"),\n  withLogs: true\n);\n```\n\nTo get the list of all voices use:\n\n```dart\n//Get voices\nfinal voicesResponse = await TtsMicrosoft.getVoices();\n\nfinal voices = voicesResponse.voices;\n\n//Print all voices\nprint(voices);\n\n//Pick an English Voice\nfinal voice = voices\n    .where((element) =\u003e element.locale.code.startsWith(\"en-\"))\n    .toList(growable: false)\n    .first;\n```\n\nTo convert TTS and get audio use:\n\n```dart\n//Generate Audio for a text\nfinal text = '\u003cspeak\u003eMicrosoft\u003cbreak time=\"2s\"\u003e Speech Service Text-to-Speech API is awesome!\u003c/speak\u003e';\n\nTtsParamsMicrosoft ttsParams = TtsParamsMicrosoft(\n        voice: voice, \n        audioFormat: AudioOutputFormatMicrosoft.audio48Khz192kBitrateMonoMp3, \n        text: text, \n        rate: 'slow', //optional\n        pitch: 'default' //optional\n      );\n\nfinal ttsResponse = await TtsMicrosoft.convertTts(ttsParams);\n\n//Get the audio bytes.\nfinal audioBytes = ttsResponse.audio.buffer.asByteData();\n```\n\n### Amazon\n\nTo init configuration use:\n\n```dart\n//Do init once and run it before any other method\nTtsAmazon.init(\n  params: InitParamsAmazon(\n    keyId: 'KEY-ID', \n    accessKey: 'ACCESS-KEY', \n    region: 'us-east-1'\n  ),\n  withLogs: true\n);\n```\n\nTo get the list of all voices use:\n\n```dart\n//Get voices\nfinal voicesResponse = await TtsAmazon.getVoices();\n\nfinal voices = voicesResponse.voices;\n\n//Print all voices\nprint(voices);\n\n//Pick an English Voice\nfinal voice = voices\n    .where((element) =\u003e element.locale.code.startsWith(\"en-\"))\n    .toList(growable: false)\n    .first;\n```\n\nTo convert TTS and get audio use:\n\n```dart\n//Generate Audio for a text\nfinal text = '\u003cspeak\u003eAmazon\u003cbreak time=\"2s\"\u003e Speech Service Text-to-Speech API is awesome!\u003c/speak\u003e';\n\nTtsParamsAmazon ttsParams = TtsParamsAmazon(\n        voice: voice, \n        audioFormat: AudioOutputFormatAmazon.audio48Khz192kBitrateMonoMp3, \n        text: text, \n        rate: 'slow', //optional\n        pitch: 'default' //optional\n);\n\nfinal ttsResponse = await TtsAmazon.convertTts(ttsParams);\n\n//Get the audio bytes.\nfinal audioBytes = ttsResponse.audio.buffer.asByteData();\n```\n\n## Notes\n\nThere are things you should take care of:\n\n- Securing of your API keys and credentials, they could be extracted from your mobile or web app.\n- Sometimes Amazon Polly is not working in emulator, so you could get 403 error.\n- For fixing SSML/XML before passing it to TTS Params, you could use\n  the [xml](https://pub.dev/packages/xml) package's,\n  methods `XmlDocument.parse(ssml).toXmlString()`.\n- Audio has uniform format for all providers, it is Uint8List that you could use to play it or save\n  it to file.\n- Some player packages that are good fit are: [audioplayers](https://pub.dev/packages/audioplayers)\n  and [assets_audio_player](https://pub.dev/packages/assets_audio_player).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkokosticdev%2Fcloud_text_to_speech_flutter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkokosticdev%2Fcloud_text_to_speech_flutter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkokosticdev%2Fcloud_text_to_speech_flutter/lists"}