Registry / cloud / go-texttospeech

go-texttospeech

JSON →
library1.21.0gogounverified

Go client library for Google Cloud Text-to-Speech API, converting text into natural-sounding speech.

go get cloud.google.com/go/texttospeech
INSTALL
IMPORT
SIG · GO-TEXTTOSPEECH
G
go-texttospeech
cloudgov1.21.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

texttospeech
cloud.google.com/go/texttospeech

Synthesizes speech from text using Google Cloud Text-to-Speech.

package main import ( "context" "fmt" texttospeech "cloud.google.com/go/texttospeech/apiv1" "cloud.google.com/go/texttospeech/apiv1/texttospeechpb" ) func main() { ctx := context.Background() client, err := texttospeech.NewClient(ctx) if err != nil { panic(err) } defer client.Close() req := &texttospeechpb.SynthesizeSpeechRequest{ Input: &texttospeechpb.SynthesisInput{InputSource: &texttospeechpb.SynthesisInput_Text{Text: "Hello"}}, Voice: &texttospeechpb.VoiceSelectionParams{LanguageCode: "en-US"}, AudioConfig: &texttospeechpb.AudioConfig{AudioEncoding: texttospeechpb.AudioEncoding_MP3}, } resp, err := client.SynthesizeSpeech(ctx, req) if err != nil { panic(err) } fmt.Println("Audio content length:", len(resp.AudioContent)) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.21.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
node
10
OpenAI (training)
1
Resources
go-texttospeech — go get go-texttospeech · libregistry