A simple wrapper for accessing Google's Text-To-Spech API and converting the results to MP3 files.
A simple wrapper for Google's Text-To-Spech API. Simply list the available voices and convert your text to a mp3 by providing your API key, language code and voicename.
- add the package as a dependency to your
dependencies: flutter: sdk: flutter text_to_speeech_api: ^0.0.1
- Initialize the TextToSpeechService (optional: provide your api key)
TextToSpeechService service = TextToSpeechService('sample api key');
- List the available voices (no api key required)
- Convert your text to a File object (api key required)
File mp3 = await service.textToSpeech( text: 'Hello World', voiceName: 'de-DE-Wavenet-D', audioEncoding: 'MP3', languageCode: 'de-DE' );
- Utilizing this audioplayer plugin you could now play your mp3 file :)