Categorygithub.com/beauxarts/tts_integration
repositorypackage
0.1.20
Repository: https://github.com/beauxarts/tts_integration.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author

# README

google-tts-integration

Tiny Google Client Text-to-Speech integration module.

Most likely you would be better served by an official module cloud.google.com/go/texttospeech/apiv1.

How to use

Add module to your project: go get github.com/beauxarts/google-tts-integration.

Prerequisites

Getting available voices for a locale

NOTE: error handling omitted for brevity.

//key := "Text-to-speech API key"
voices, _ := google_tts_integration.GetVoices(http.DefaultClient, "en-US", key)

Synthesizing audio from text

NOTE: error handling omitted for brevity.

//key := "Text-to-speech API key"
text := "Hello, World!" //The input size is limited to 5000 characters.
voice := google_tts_integration.NewVoiceSelectionParams("en-US", "en-US-WaveNet-A", google_tts_integration.Male)

tsr, _ := google_tts_integration.PostTextSynthesize(http.DefaultClient, text, voice, key)

//tsr.Bytes() is an OggOpus encoded audio (default format used by this module)