texttospeech
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package texttospeech provides access to the Cloud Text-to-Speech API.
This package is DEPRECATED. Use package cloud.google.com/go/texttospeech/apiv1 instead.
For product documentation, see:https://cloud.google.com/text-to-speech/
Library status¶
These client libraries are officially supported by Google. However, thislibrary is considered complete and is in maintenance mode. This meansthat we will address critical bugs and security issues but will not addany new features.
When possible, we recommend using our newer[Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)that are still actively being worked and iterated on.
Creating a client¶
Usage example:
import "google.golang.org/api/texttospeech/v1beta1"...ctx := context.Background()texttospeechService, err := texttospeech.NewService(ctx)
In this example, Google Application Default Credentials are used forauthentication. For information on how to create and obtain ApplicationDefault Credentials, seehttps://developers.google.com/identity/protocols/application-default-credentials.
Other authentication options¶
To use an API key for authentication (note: some APIs do not support APIkeys), usegoogle.golang.org/api/option.WithAPIKey:
texttospeechService, err := texttospeech.NewService(ctx, option.WithAPIKey("AIza..."))To use an OAuth token (e.g., a user token obtained via a three-legged OAuthflow, usegoogle.golang.org/api/option.WithTokenSource:
config := &oauth2.Config{...}// ...token, err := config.Exchange(ctx, ...)texttospeechService, err := texttospeech.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))Seegoogle.golang.org/api/option.ClientOption for details on options.
Index¶
- Constants
- type AdvancedVoiceOptions
- type AudioConfig
- type CustomPronunciationParams
- type CustomPronunciations
- type CustomVoiceParams
- type GoogleCloudTexttospeechV1beta1SynthesizeLongAudioMetadata
- type ListOperationsResponse
- type ListVoicesResponse
- type MultiSpeakerMarkup
- type MultiSpeakerVoiceConfig
- type MultispeakerPrebuiltVoice
- type Operation
- type ProjectsLocationsOperationsGetCall
- func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall
- func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall
- func (c *ProjectsLocationsOperationsGetCall) Header() http.Header
- func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall
- type ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error)
- func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) Header() http.Header
- func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error
- func (c *ProjectsLocationsOperationsListCall) ReturnPartialSuccess(returnPartialSuccess bool) *ProjectsLocationsOperationsListCall
- type ProjectsLocationsOperationsService
- type ProjectsLocationsService
- type ProjectsLocationsSynthesizeLongAudioCall
- func (c *ProjectsLocationsSynthesizeLongAudioCall) Context(ctx context.Context) *ProjectsLocationsSynthesizeLongAudioCall
- func (c *ProjectsLocationsSynthesizeLongAudioCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsSynthesizeLongAudioCall) Fields(s ...googleapi.Field) *ProjectsLocationsSynthesizeLongAudioCall
- func (c *ProjectsLocationsSynthesizeLongAudioCall) Header() http.Header
- type ProjectsService
- type Service
- type Status
- type SynthesisInput
- type SynthesizeLongAudioMetadata
- type SynthesizeLongAudioRequest
- type SynthesizeSpeechRequest
- type SynthesizeSpeechResponse
- type TextService
- type TextSynthesizeCall
- type Timepoint
- type Turn
- type Voice
- type VoiceCloneParams
- type VoiceSelectionParams
- type VoicesListCall
- func (c *VoicesListCall) Context(ctx context.Context) *VoicesListCall
- func (c *VoicesListCall) Do(opts ...googleapi.CallOption) (*ListVoicesResponse, error)
- func (c *VoicesListCall) Fields(s ...googleapi.Field) *VoicesListCall
- func (c *VoicesListCall) Header() http.Header
- func (c *VoicesListCall) IfNoneMatch(entityTag string) *VoicesListCall
- func (c *VoicesListCall) LanguageCode(languageCode string) *VoicesListCall
- type VoicesService
Constants¶
const (// See, edit, configure, and delete your Google Cloud data and see the email// address for your Google Account.CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform")
OAuth2 scopes used by this API.
Variables¶
This section is empty.
Functions¶
This section is empty.
Types¶
typeAdvancedVoiceOptions¶added inv0.200.0
type AdvancedVoiceOptions struct {// LowLatencyJourneySynthesis: Only for Journey voices. If false, the synthesis// is context aware and has a higher latency.LowLatencyJourneySynthesisbool `json:"lowLatencyJourneySynthesis,omitempty"`// RelaxSafetyFilters: Optional. Input only. If true, relaxes safety filters// for Gemini TTS. Only supported for accounts linked to Invoiced (Offline)// Cloud billing accounts. Otherwise, will return result// google.rpc.Code.INVALID_ARGUMENT.RelaxSafetyFiltersbool `json:"relaxSafetyFilters,omitempty"`// ForceSendFields is a list of field names (e.g. "LowLatencyJourneySynthesis")// to unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "LowLatencyJourneySynthesis") to// include in API requests with the JSON null value. By default, fields with// empty values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}AdvancedVoiceOptions: Used for advanced voice options.
func (AdvancedVoiceOptions)MarshalJSON¶added inv0.200.0
func (sAdvancedVoiceOptions) MarshalJSON() ([]byte,error)
typeAudioConfig¶
type AudioConfig struct {// AudioEncoding: Required. The format of the audio byte stream.//// Possible values:// "AUDIO_ENCODING_UNSPECIFIED" - Not specified. Only used by// GenerateVoiceCloningKey. Otherwise, will return result// google.rpc.Code.INVALID_ARGUMENT.// "LINEAR16" - Uncompressed 16-bit signed little-endian samples (Linear// PCM). Audio content returned as LINEAR16 also contains a WAV header.// "MP3" - MP3 audio at 32kbps.// "MP3_64_KBPS" - MP3 at 64kbps.// "OGG_OPUS" - Opus encoded audio wrapped in an ogg container. The result is// a file which can be played natively on Android, and in browsers (at least// Chrome and Firefox). The quality of the encoding is considerably higher than// MP3 while using approximately the same bitrate.// "MULAW" - 8-bit samples that compand 14-bit audio samples using G.711// PCMU/mu-law. Audio content returned as MULAW also contains a WAV header.// "ALAW" - 8-bit samples that compand 14-bit audio samples using G.711// PCMU/A-law. Audio content returned as ALAW also contains a WAV header.// "PCM" - Uncompressed 16-bit signed little-endian samples (Linear PCM).// Note that as opposed to LINEAR16, audio won't be wrapped in a WAV (or any// other) header.// "M4A" - M4A audio.AudioEncodingstring `json:"audioEncoding,omitempty"`// EffectsProfileId: Optional. Input only. An identifier which selects 'audio// effects' profiles that are applied on (post synthesized) text to speech.// Effects are applied on top of each other in the order they are given. See// audio profiles (https://cloud.google.com/text-to-speech/docs/audio-profiles)// for current supported profile ids.EffectsProfileId []string `json:"effectsProfileId,omitempty"`// Pitch: Optional. Input only. Speaking pitch, in the range [-20.0, 20.0]. 20// means increase 20 semitones from the original pitch. -20 means decrease 20// semitones from the original pitch.Pitchfloat64 `json:"pitch,omitempty"`// SampleRateHertz: Optional. The synthesis sample rate (in hertz) for this// audio. When this is specified in SynthesizeSpeechRequest, if this is// different from the voice's natural sample rate, then the synthesizer will// honor this request by converting to the desired sample rate (which might// result in worse audio quality), unless the specified sample rate is not// supported for the encoding chosen, in which case it will fail the request// and return google.rpc.Code.INVALID_ARGUMENT.SampleRateHertzint64 `json:"sampleRateHertz,omitempty"`// SpeakingRate: Optional. Input only. Speaking rate/speed, in the range [0.25,// 2.0]. 1.0 is the normal native speed supported by the specific voice. 2.0 is// twice as fast, and 0.5 is half as fast. If unset(0.0), defaults to the// native 1.0 speed. Any other values < 0.25 or > 2.0 will return an error.SpeakingRatefloat64 `json:"speakingRate,omitempty"`// VolumeGainDb: Optional. Input only. Volume gain (in dB) of the normal native// volume supported by the specific voice, in the range [-96.0, 16.0]. If// unset, or set to a value of 0.0 (dB), will play at normal native signal// amplitude. A value of -6.0 (dB) will play at approximately half the// amplitude of the normal native signal amplitude. A value of +6.0 (dB) will// play at approximately twice the amplitude of the normal native signal// amplitude. Strongly recommend not to exceed +10 (dB) as there's usually no// effective increase in loudness for any value greater than that.VolumeGainDbfloat64 `json:"volumeGainDb,omitempty"`// ForceSendFields is a list of field names (e.g. "AudioEncoding") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "AudioEncoding") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}AudioConfig: Description of audio data to be synthesized.
func (AudioConfig)MarshalJSON¶
func (sAudioConfig) MarshalJSON() ([]byte,error)
func (*AudioConfig)UnmarshalJSON¶
func (s *AudioConfig) UnmarshalJSON(data []byte)error
typeCustomPronunciationParams¶added inv0.200.0
type CustomPronunciationParams struct {// PhoneticEncoding: The phonetic encoding of the phrase.//// Possible values:// "PHONETIC_ENCODING_UNSPECIFIED" - Not specified.// "PHONETIC_ENCODING_IPA" - IPA, such as apple -> ˈæpəl.//https://en.wikipedia.org/wiki/International_Phonetic_Alphabet// "PHONETIC_ENCODING_X_SAMPA" - X-SAMPA, such as apple -> "{p@l".//https://en.wikipedia.org/wiki/X-SAMPA// "PHONETIC_ENCODING_JAPANESE_YOMIGANA" - For reading-to-pron conversion to// work well, the `pronunciation` field should only contain Kanji, Hiragana,// and Katakana. The pronunciation can also contain pitch accents. The start of// a pitch phrase is specified with `^` and the down-pitch position is// specified with `!`, for example: phrase:端 pronunciation:^はし phrase:箸// pronunciation:^は!し phrase:橋 pronunciation:^はし! We currently only// support the Tokyo dialect, which allows at most one down-pitch per phrase// (i.e. at most one `!` between `^`).// "PHONETIC_ENCODING_PINYIN" - Used to specify pronunciations for Mandarin// words. Seehttps://en.wikipedia.org/wiki/Pinyin. For example: 朝阳, the// pronunciation is "chao2 yang2". The number represents the tone, and there is// a space between syllables. Neutral tones are represented by 5, for example// 孩子 "hai2 zi5".PhoneticEncodingstring `json:"phoneticEncoding,omitempty"`// Phrase: The phrase to which the customization is applied. The phrase can be// multiple words, such as proper nouns, but shouldn't span the length of the// sentence.Phrasestring `json:"phrase,omitempty"`// Pronunciation: The pronunciation of the phrase. This must be in the phonetic// encoding specified above.Pronunciationstring `json:"pronunciation,omitempty"`// ForceSendFields is a list of field names (e.g. "PhoneticEncoding") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "PhoneticEncoding") to include in// API requests with the JSON null value. By default, fields with empty values// are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}CustomPronunciationParams: Pronunciation customization for a phrase.
func (CustomPronunciationParams)MarshalJSON¶added inv0.200.0
func (sCustomPronunciationParams) MarshalJSON() ([]byte,error)
typeCustomPronunciations¶added inv0.200.0
type CustomPronunciations struct {// Pronunciations: The pronunciation customizations are applied.Pronunciations []*CustomPronunciationParams `json:"pronunciations,omitempty"`// ForceSendFields is a list of field names (e.g. "Pronunciations") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Pronunciations") to include in// API requests with the JSON null value. By default, fields with empty values// are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}CustomPronunciations: A collection of pronunciation customizations.
func (CustomPronunciations)MarshalJSON¶added inv0.200.0
func (sCustomPronunciations) MarshalJSON() ([]byte,error)
typeCustomVoiceParams¶added inv0.60.0
type CustomVoiceParams struct {// Model: Required. The name of the AutoML model that synthesizes the custom// voice.Modelstring `json:"model,omitempty"`// ReportedUsage: Optional. Deprecated. The usage of the synthesized audio to// be reported.//// Possible values:// "REPORTED_USAGE_UNSPECIFIED" - Request with reported usage unspecified// will be rejected.// "REALTIME" - For scenarios where the synthesized audio is not downloadable// and can only be used once. For example, real-time request in IVR system.// "OFFLINE" - For scenarios where the synthesized audio is downloadable and// can be reused. For example, the synthesized audio is downloaded, stored in// customer service system and played repeatedly.ReportedUsagestring `json:"reportedUsage,omitempty"`// ForceSendFields is a list of field names (e.g. "Model") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Model") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}CustomVoiceParams: Description of the custom voice to be synthesized.
func (CustomVoiceParams)MarshalJSON¶added inv0.60.0
func (sCustomVoiceParams) MarshalJSON() ([]byte,error)
typeGoogleCloudTexttospeechV1beta1SynthesizeLongAudioMetadata¶added inv0.107.0
type GoogleCloudTexttospeechV1beta1SynthesizeLongAudioMetadata struct {// LastUpdateTime: Deprecated. Do not use.LastUpdateTimestring `json:"lastUpdateTime,omitempty"`// ProgressPercentage: The progress of the most recent processing update in// percentage, ie. 70.0%.ProgressPercentagefloat64 `json:"progressPercentage,omitempty"`// StartTime: Time when the request was received.StartTimestring `json:"startTime,omitempty"`// ForceSendFields is a list of field names (e.g. "LastUpdateTime") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "LastUpdateTime") to include in// API requests with the JSON null value. By default, fields with empty values// are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}GoogleCloudTexttospeechV1beta1SynthesizeLongAudioMetadata: Metadata forresponse returned by the `SynthesizeLongAudio` method.
func (GoogleCloudTexttospeechV1beta1SynthesizeLongAudioMetadata)MarshalJSON¶added inv0.107.0
func (sGoogleCloudTexttospeechV1beta1SynthesizeLongAudioMetadata) MarshalJSON() ([]byte,error)
func (*GoogleCloudTexttospeechV1beta1SynthesizeLongAudioMetadata)UnmarshalJSON¶added inv0.107.0
func (s *GoogleCloudTexttospeechV1beta1SynthesizeLongAudioMetadata) UnmarshalJSON(data []byte)error
typeListOperationsResponse¶added inv0.106.0
type ListOperationsResponse struct {// NextPageToken: The standard List next-page token.NextPageTokenstring `json:"nextPageToken,omitempty"`// Operations: A list of operations that matches the specified filter in the// request.Operations []*Operation `json:"operations,omitempty"`// Unreachable: Unordered list. Unreachable resources. Populated when the// request sets `ListOperationsRequest.return_partial_success` and reads across// collections e.g. when attempting to list all resources across all supported// locations.Unreachable []string `json:"unreachable,omitempty"`// ServerResponse contains the HTTP response code and headers from the server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "NextPageToken") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "NextPageToken") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}ListOperationsResponse: The response message for Operations.ListOperations.
func (ListOperationsResponse)MarshalJSON¶added inv0.106.0
func (sListOperationsResponse) MarshalJSON() ([]byte,error)
typeListVoicesResponse¶
type ListVoicesResponse struct {// Voices: The list of voices.Voices []*Voice `json:"voices,omitempty"`// ServerResponse contains the HTTP response code and headers from the server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "Voices") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Voices") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}ListVoicesResponse: The message returned to the client by the `ListVoices`method.
func (ListVoicesResponse)MarshalJSON¶
func (sListVoicesResponse) MarshalJSON() ([]byte,error)
typeMultiSpeakerMarkup¶added inv0.204.0
type MultiSpeakerMarkup struct {// Turns: Required. Speaker turns.Turns []*Turn `json:"turns,omitempty"`// ForceSendFields is a list of field names (e.g. "Turns") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Turns") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}MultiSpeakerMarkup: A collection of turns for multi-speaker synthesis.
func (MultiSpeakerMarkup)MarshalJSON¶added inv0.204.0
func (sMultiSpeakerMarkup) MarshalJSON() ([]byte,error)
typeMultiSpeakerVoiceConfig¶added inv0.251.0
type MultiSpeakerVoiceConfig struct {// SpeakerVoiceConfigs: Required. A list of configurations for the voices of// the speakers. Exactly two speaker voice configurations must be provided.SpeakerVoiceConfigs []*MultispeakerPrebuiltVoice `json:"speakerVoiceConfigs,omitempty"`// ForceSendFields is a list of field names (e.g. "SpeakerVoiceConfigs") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "SpeakerVoiceConfigs") to include// in API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}MultiSpeakerVoiceConfig: Configuration for a multi-speaker text-to-speechsetup. Enables the use of up to two distinct voices in a single synthesisrequest.
func (MultiSpeakerVoiceConfig)MarshalJSON¶added inv0.251.0
func (sMultiSpeakerVoiceConfig) MarshalJSON() ([]byte,error)
typeMultispeakerPrebuiltVoice¶added inv0.251.0
type MultispeakerPrebuiltVoice struct {// SpeakerAlias: Required. The speaker alias of the voice. This is the// user-chosen speaker name that is used in the multispeaker text input, such// as "Speaker1".SpeakerAliasstring `json:"speakerAlias,omitempty"`// SpeakerId: Required. The speaker ID of the voice. See//https://cloud.google.com/text-to-speech/docs/gemini-tts#voice_options for// available values.SpeakerIdstring `json:"speakerId,omitempty"`// ForceSendFields is a list of field names (e.g. "SpeakerAlias") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "SpeakerAlias") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}MultispeakerPrebuiltVoice: Configuration for a single speaker in a GeminiTTS multi-speaker setup. Enables dialogue between two speakers.
func (MultispeakerPrebuiltVoice)MarshalJSON¶added inv0.251.0
func (sMultispeakerPrebuiltVoice) MarshalJSON() ([]byte,error)
typeOperation¶added inv0.104.0
type Operation struct {// Done: If the value is `false`, it means the operation is still in progress.// If `true`, the operation is completed, and either `error` or `response` is// available.Donebool `json:"done,omitempty"`// Error: The error result of the operation in case of failure or cancellation.Error *Status `json:"error,omitempty"`// Metadata: Service-specific metadata associated with the operation. It// typically contains progress information and common metadata such as create// time. Some services might not provide such metadata. Any method that returns// a long-running operation should document the metadata type, if any.Metadatagoogleapi.RawMessage `json:"metadata,omitempty"`// Name: The server-assigned name, which is only unique within the same service// that originally returns it. If you use the default HTTP mapping, the `name`// should be a resource name ending with `operations/{unique_id}`.Namestring `json:"name,omitempty"`// Response: The normal, successful response of the operation. If the original// method returns no data on success, such as `Delete`, the response is// `google.protobuf.Empty`. If the original method is standard// `Get`/`Create`/`Update`, the response should be the resource. For other// methods, the response should have the type `XxxResponse`, where `Xxx` is the// original method name. For example, if the original method name is// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.Responsegoogleapi.RawMessage `json:"response,omitempty"`// ServerResponse contains the HTTP response code and headers from the server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "Done") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Done") to include in API requests// with the JSON null value. By default, fields with empty values are omitted// from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}Operation: This resource represents a long-running operation that is theresult of a network API call.
func (Operation)MarshalJSON¶added inv0.104.0
typeProjectsLocationsOperationsGetCall¶added inv0.106.0
type ProjectsLocationsOperationsGetCall struct {// contains filtered or unexported fields}func (*ProjectsLocationsOperationsGetCall)Context¶added inv0.106.0
func (c *ProjectsLocationsOperationsGetCall) Context(ctxcontext.Context) *ProjectsLocationsOperationsGetCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsOperationsGetCall)Do¶added inv0.106.0
func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation,error)
Do executes the "texttospeech.projects.locations.operations.get" call.Any non-2xx status code is an error. Response headers are in either*Operation.ServerResponse.Header or (if a response was returned at all) inerror.(*googleapi.Error).Header. Use googleapi.IsNotModified to checkwhether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsOperationsGetCall)Fields¶added inv0.106.0
func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.
func (*ProjectsLocationsOperationsGetCall)Header¶added inv0.106.0
func (c *ProjectsLocationsOperationsGetCall) Header()http.Header
Header returns a http.Header that can be modified by the caller to addheaders to the request.
func (*ProjectsLocationsOperationsGetCall)IfNoneMatch¶added inv0.106.0
func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTagstring) *ProjectsLocationsOperationsGetCall
IfNoneMatch sets an optional parameter which makes the operation fail if theobject's ETag matches the given value. This is useful for getting updatesonly after the object has changed since the last request.
typeProjectsLocationsOperationsListCall¶added inv0.106.0
type ProjectsLocationsOperationsListCall struct {// contains filtered or unexported fields}func (*ProjectsLocationsOperationsListCall)Context¶added inv0.106.0
func (c *ProjectsLocationsOperationsListCall) Context(ctxcontext.Context) *ProjectsLocationsOperationsListCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsOperationsListCall)Do¶added inv0.106.0
func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse,error)
Do executes the "texttospeech.projects.locations.operations.list" call.Any non-2xx status code is an error. Response headers are in either*ListOperationsResponse.ServerResponse.Header or (if a response was returnedat all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified tocheck whether the returned error was because http.StatusNotModified wasreturned.
func (*ProjectsLocationsOperationsListCall)Fields¶added inv0.106.0
func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.
func (*ProjectsLocationsOperationsListCall)Filter¶added inv0.106.0
func (c *ProjectsLocationsOperationsListCall) Filter(filterstring) *ProjectsLocationsOperationsListCall
Filter sets the optional parameter "filter": The standard list filter.
func (*ProjectsLocationsOperationsListCall)Header¶added inv0.106.0
func (c *ProjectsLocationsOperationsListCall) Header()http.Header
Header returns a http.Header that can be modified by the caller to addheaders to the request.
func (*ProjectsLocationsOperationsListCall)IfNoneMatch¶added inv0.106.0
func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTagstring) *ProjectsLocationsOperationsListCall
IfNoneMatch sets an optional parameter which makes the operation fail if theobject's ETag matches the given value. This is useful for getting updatesonly after the object has changed since the last request.
func (*ProjectsLocationsOperationsListCall)PageSize¶added inv0.106.0
func (c *ProjectsLocationsOperationsListCall) PageSize(pageSizeint64) *ProjectsLocationsOperationsListCall
PageSize sets the optional parameter "pageSize": The standard list pagesize.
func (*ProjectsLocationsOperationsListCall)PageToken¶added inv0.106.0
func (c *ProjectsLocationsOperationsListCall) PageToken(pageTokenstring) *ProjectsLocationsOperationsListCall
PageToken sets the optional parameter "pageToken": The standard list pagetoken.
func (*ProjectsLocationsOperationsListCall)Pages¶added inv0.106.0
func (c *ProjectsLocationsOperationsListCall) Pages(ctxcontext.Context, f func(*ListOperationsResponse)error)error
Pages invokes f for each page of results.A non-nil error returned from f will halt the iteration.The provided context supersedes any context provided to the Context method.
func (*ProjectsLocationsOperationsListCall)ReturnPartialSuccess¶added inv0.253.0
func (c *ProjectsLocationsOperationsListCall) ReturnPartialSuccess(returnPartialSuccessbool) *ProjectsLocationsOperationsListCall
ReturnPartialSuccess sets the optional parameter "returnPartialSuccess":When set to `true`, operations that are reachable are returned as normal,and those that are unreachable are returned in the[ListOperationsResponse.unreachable] field. This can only be `true` whenreading across collections e.g. when `parent` is set to"projects/example/locations/-". This field is not by default supported andwill result in an `UNIMPLEMENTED` error if set unless explicitly documentedotherwise in service or product specific documentation.
typeProjectsLocationsOperationsService¶added inv0.106.0
type ProjectsLocationsOperationsService struct {// contains filtered or unexported fields}funcNewProjectsLocationsOperationsService¶added inv0.106.0
func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService
func (*ProjectsLocationsOperationsService)Get¶added inv0.106.0
func (r *ProjectsLocationsOperationsService) Get(namestring) *ProjectsLocationsOperationsGetCall
Get: Gets the latest state of a long-running operation. Clients can use thismethod to poll the operation result at intervals as recommended by the APIservice.
- name: The name of the operation resource.
func (*ProjectsLocationsOperationsService)List¶added inv0.106.0
func (r *ProjectsLocationsOperationsService) List(namestring) *ProjectsLocationsOperationsListCall
List: Lists operations that match the specified filter in the request. Ifthe server doesn't support this method, it returns `UNIMPLEMENTED`.
- name: The name of the operation's parent resource.
typeProjectsLocationsService¶added inv0.104.0
type ProjectsLocationsService struct {Operations *ProjectsLocationsOperationsService// contains filtered or unexported fields}funcNewProjectsLocationsService¶added inv0.104.0
func NewProjectsLocationsService(s *Service) *ProjectsLocationsService
func (*ProjectsLocationsService)SynthesizeLongAudio¶added inv0.106.0
func (r *ProjectsLocationsService) SynthesizeLongAudio(parentstring, synthesizelongaudiorequest *SynthesizeLongAudioRequest) *ProjectsLocationsSynthesizeLongAudioCall
SynthesizeLongAudio: Synthesizes long form text asynchronously.
- parent: The resource states of the request in the form of`projects/*/locations/*`.
typeProjectsLocationsSynthesizeLongAudioCall¶added inv0.106.0
type ProjectsLocationsSynthesizeLongAudioCall struct {// contains filtered or unexported fields}func (*ProjectsLocationsSynthesizeLongAudioCall)Context¶added inv0.106.0
func (c *ProjectsLocationsSynthesizeLongAudioCall) Context(ctxcontext.Context) *ProjectsLocationsSynthesizeLongAudioCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsSynthesizeLongAudioCall)Do¶added inv0.106.0
func (c *ProjectsLocationsSynthesizeLongAudioCall) Do(opts ...googleapi.CallOption) (*Operation,error)
Do executes the "texttospeech.projects.locations.synthesizeLongAudio" call.Any non-2xx status code is an error. Response headers are in either*Operation.ServerResponse.Header or (if a response was returned at all) inerror.(*googleapi.Error).Header. Use googleapi.IsNotModified to checkwhether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsSynthesizeLongAudioCall)Fields¶added inv0.106.0
func (c *ProjectsLocationsSynthesizeLongAudioCall) Fields(s ...googleapi.Field) *ProjectsLocationsSynthesizeLongAudioCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.
func (*ProjectsLocationsSynthesizeLongAudioCall)Header¶added inv0.106.0
func (c *ProjectsLocationsSynthesizeLongAudioCall) Header()http.Header
Header returns a http.Header that can be modified by the caller to addheaders to the request.
typeProjectsService¶added inv0.104.0
type ProjectsService struct {Locations *ProjectsLocationsService// contains filtered or unexported fields}funcNewProjectsService¶added inv0.104.0
func NewProjectsService(s *Service) *ProjectsService
typeService¶
type Service struct {BasePathstring// API endpoint base URLUserAgentstring// optional additional User-Agent fragmentProjects *ProjectsServiceText *TextServiceVoices *VoicesService// contains filtered or unexported fields} funcNewdeprecated
New creates a new Service. It uses the provided http.Client for requests.
Deprecated: please use NewService instead.To provide a custom HTTP client, use option.WithHTTPClient.If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
funcNewService¶added inv0.3.0
NewService creates a new Service.
typeStatus¶added inv0.104.0
type Status struct {// Code: The status code, which should be an enum value of google.rpc.Code.Codeint64 `json:"code,omitempty"`// Details: A list of messages that carry the error details. There is a common// set of message types for APIs to use.Details []googleapi.RawMessage `json:"details,omitempty"`// Message: A developer-facing error message, which should be in English. Any// user-facing error message should be localized and sent in the// google.rpc.Status.details field, or localized by the client.Messagestring `json:"message,omitempty"`// ForceSendFields is a list of field names (e.g. "Code") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Code") to include in API requests// with the JSON null value. By default, fields with empty values are omitted// from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}Status: The `Status` type defines a logical error model that is suitable fordifferent programming environments, including REST APIs and RPC APIs. It isused by gRPC (https://github.com/grpc). Each `Status` message contains threepieces of data: error code, error message, and error details. You can findout more about this error model and how to work with it in the API DesignGuide (https://cloud.google.com/apis/design/errors).
func (Status)MarshalJSON¶added inv0.104.0
typeSynthesisInput¶
type SynthesisInput struct {// CustomPronunciations: Optional. The pronunciation customizations are applied// to the input. If this is set, the input is synthesized using the given// pronunciation customizations. The initial support is for en-us, with plans// to expand to other locales in the future. Instant Clone voices aren't// supported. In order to customize the pronunciation of a phrase, there must// be an exact match of the phrase in the input types. If using SSML, the// phrase must not be inside a phoneme tag.CustomPronunciations *CustomPronunciations `json:"customPronunciations,omitempty"`// Markup: Markup for HD voices specifically. This field may not be used with// any other voices.Markupstring `json:"markup,omitempty"`// MultiSpeakerMarkup: The multi-speaker input to be synthesized. Only// applicable for multi-speaker synthesis.MultiSpeakerMarkup *MultiSpeakerMarkup `json:"multiSpeakerMarkup,omitempty"`// Prompt: This system instruction is supported only for// controllable/promptable voice models. If this system instruction is used, we// pass the unedited text to Gemini-TTS. Otherwise, a default system// instruction is used. AI Studio calls this system instruction, Style// Instructions.Promptstring `json:"prompt,omitempty"`// Ssml: The SSML document to be synthesized. The SSML document must be valid// and well-formed. Otherwise the RPC will fail and return// google.rpc.Code.INVALID_ARGUMENT. For more information, see SSML// (https://cloud.google.com/text-to-speech/docs/ssml).Ssmlstring `json:"ssml,omitempty"`// Text: The raw text to be synthesized.Textstring `json:"text,omitempty"`// ForceSendFields is a list of field names (e.g. "CustomPronunciations") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "CustomPronunciations") to include// in API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}SynthesisInput: Contains text input to be synthesized. Either `text` or`ssml` must be supplied. Supplying both or neither returnsgoogle.rpc.Code.INVALID_ARGUMENT. The input size is limited to 5000 bytes.
func (SynthesisInput)MarshalJSON¶
func (sSynthesisInput) MarshalJSON() ([]byte,error)
typeSynthesizeLongAudioMetadata¶added inv0.107.0
type SynthesizeLongAudioMetadata struct {// LastUpdateTime: Deprecated. Do not use.LastUpdateTimestring `json:"lastUpdateTime,omitempty"`// ProgressPercentage: The progress of the most recent processing update in// percentage, ie. 70.0%.ProgressPercentagefloat64 `json:"progressPercentage,omitempty"`// StartTime: Time when the request was received.StartTimestring `json:"startTime,omitempty"`// ForceSendFields is a list of field names (e.g. "LastUpdateTime") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "LastUpdateTime") to include in// API requests with the JSON null value. By default, fields with empty values// are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}SynthesizeLongAudioMetadata: Metadata for response returned by the`SynthesizeLongAudio` method.
func (SynthesizeLongAudioMetadata)MarshalJSON¶added inv0.107.0
func (sSynthesizeLongAudioMetadata) MarshalJSON() ([]byte,error)
func (*SynthesizeLongAudioMetadata)UnmarshalJSON¶added inv0.107.0
func (s *SynthesizeLongAudioMetadata) UnmarshalJSON(data []byte)error
typeSynthesizeLongAudioRequest¶added inv0.104.0
type SynthesizeLongAudioRequest struct {// AudioConfig: Required. The configuration of the synthesized audio.AudioConfig *AudioConfig `json:"audioConfig,omitempty"`// Input: Required. The Synthesizer requires either plain text or SSML as// input.Input *SynthesisInput `json:"input,omitempty"`// OutputGcsUri: Required. Specifies a Cloud Storage URI for the synthesis// results. Must be specified in the format: `gs://bucket_name/object_name`,// and the bucket must already exist.OutputGcsUristring `json:"outputGcsUri,omitempty"`// Voice: Required. The desired voice of the synthesized audio.Voice *VoiceSelectionParams `json:"voice,omitempty"`// ForceSendFields is a list of field names (e.g. "AudioConfig") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "AudioConfig") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}SynthesizeLongAudioRequest: The top-level message sent by the client for the`SynthesizeLongAudio` method.
func (SynthesizeLongAudioRequest)MarshalJSON¶added inv0.104.0
func (sSynthesizeLongAudioRequest) MarshalJSON() ([]byte,error)
typeSynthesizeSpeechRequest¶
type SynthesizeSpeechRequest struct {// AdvancedVoiceOptions: Advanced voice options.AdvancedVoiceOptions *AdvancedVoiceOptions `json:"advancedVoiceOptions,omitempty"`// AudioConfig: Required. The configuration of the synthesized audio.AudioConfig *AudioConfig `json:"audioConfig,omitempty"`// EnableTimePointing: Whether and what timepoints are returned in the// response.//// Possible values:// "TIMEPOINT_TYPE_UNSPECIFIED" - Not specified. No timepoint information// will be returned.// "SSML_MARK" - Timepoint information of “ tags in SSML input will be// returned.EnableTimePointing []string `json:"enableTimePointing,omitempty"`// Input: Required. The Synthesizer requires either plain text or SSML as// input.Input *SynthesisInput `json:"input,omitempty"`// Voice: Required. The desired voice of the synthesized audio.Voice *VoiceSelectionParams `json:"voice,omitempty"`// ForceSendFields is a list of field names (e.g. "AdvancedVoiceOptions") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "AdvancedVoiceOptions") to include// in API requests with the JSON null value. By default, fields with empty// values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}SynthesizeSpeechRequest: The top-level message sent by the client for the`SynthesizeSpeech` method.
func (SynthesizeSpeechRequest)MarshalJSON¶
func (sSynthesizeSpeechRequest) MarshalJSON() ([]byte,error)
typeSynthesizeSpeechResponse¶
type SynthesizeSpeechResponse struct {// AudioConfig: The audio metadata of `audio_content`.AudioConfig *AudioConfig `json:"audioConfig,omitempty"`// AudioContent: The audio data bytes encoded as specified in the request,// including the header for encodings that are wrapped in containers (e.g. MP3,// OGG_OPUS). For LINEAR16 audio, we include the WAV header. Note: as with all// bytes fields, protobuffers use a pure binary representation, whereas JSON// representations use base64.AudioContentstring `json:"audioContent,omitempty"`// Timepoints: A link between a position in the original request input and a// corresponding time in the output audio. It's only supported via “ of SSML// input.Timepoints []*Timepoint `json:"timepoints,omitempty"`// ServerResponse contains the HTTP response code and headers from the server.googleapi.ServerResponse `json:"-"`// ForceSendFields is a list of field names (e.g. "AudioConfig") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "AudioConfig") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}SynthesizeSpeechResponse: The message returned to the client by the`SynthesizeSpeech` method.
func (SynthesizeSpeechResponse)MarshalJSON¶
func (sSynthesizeSpeechResponse) MarshalJSON() ([]byte,error)
typeTextService¶
type TextService struct {// contains filtered or unexported fields}funcNewTextService¶
func NewTextService(s *Service) *TextService
func (*TextService)Synthesize¶
func (r *TextService) Synthesize(synthesizespeechrequest *SynthesizeSpeechRequest) *TextSynthesizeCall
Synthesize: Synthesizes speech synchronously: receive results after all textinput has been processed.
typeTextSynthesizeCall¶
type TextSynthesizeCall struct {// contains filtered or unexported fields}func (*TextSynthesizeCall)Context¶
func (c *TextSynthesizeCall) Context(ctxcontext.Context) *TextSynthesizeCall
Context sets the context to be used in this call's Do method.
func (*TextSynthesizeCall)Do¶
func (c *TextSynthesizeCall) Do(opts ...googleapi.CallOption) (*SynthesizeSpeechResponse,error)
Do executes the "texttospeech.text.synthesize" call.Any non-2xx status code is an error. Response headers are in either*SynthesizeSpeechResponse.ServerResponse.Header or (if a response wasreturned at all) in error.(*googleapi.Error).Header. Usegoogleapi.IsNotModified to check whether the returned error was becausehttp.StatusNotModified was returned.
func (*TextSynthesizeCall)Fields¶
func (c *TextSynthesizeCall) Fields(s ...googleapi.Field) *TextSynthesizeCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.
func (*TextSynthesizeCall)Header¶
func (c *TextSynthesizeCall) Header()http.Header
Header returns a http.Header that can be modified by the caller to addheaders to the request.
typeTimepoint¶added inv0.31.0
type Timepoint struct {// MarkName: Timepoint name as received from the client within “ tag.MarkNamestring `json:"markName,omitempty"`// TimeSeconds: Time offset in seconds from the start of the synthesized audio.TimeSecondsfloat64 `json:"timeSeconds,omitempty"`// ForceSendFields is a list of field names (e.g. "MarkName") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "MarkName") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}Timepoint: This contains a mapping between a certain point in the input textand a corresponding time in the output audio.
func (Timepoint)MarshalJSON¶added inv0.31.0
func (*Timepoint)UnmarshalJSON¶added inv0.31.0
typeTurn¶added inv0.204.0
type Turn struct {// Speaker: Required. The speaker of the turn, for example, 'O' or 'Q'. Please// refer to documentation for available speakers.Speakerstring `json:"speaker,omitempty"`// Text: Required. The text to speak.Textstring `json:"text,omitempty"`// ForceSendFields is a list of field names (e.g. "Speaker") to unconditionally// include in API requests. By default, fields with empty or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "Speaker") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}Turn: A multi-speaker turn.
func (Turn)MarshalJSON¶added inv0.204.0
typeVoice¶
type Voice struct {// LanguageCodes: The languages that this voice supports, expressed as BCP-47// (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tags (e.g. "en-US",// "es-419", "cmn-tw").LanguageCodes []string `json:"languageCodes,omitempty"`// Name: The name of this voice. Each distinct voice has a unique name.Namestring `json:"name,omitempty"`// NaturalSampleRateHertz: The natural sample rate (in hertz) for this voice.NaturalSampleRateHertzint64 `json:"naturalSampleRateHertz,omitempty"`// SsmlGender: The gender of this voice.//// Possible values:// "SSML_VOICE_GENDER_UNSPECIFIED" - An unspecified gender. In// VoiceSelectionParams, this means that the client doesn't care which gender// the selected voice will have. In the Voice field of ListVoicesResponse, this// may mean that the voice doesn't fit any of the other categories in this// enum, or that the gender of the voice isn't known.// "MALE" - A male voice.// "FEMALE" - A female voice.// "NEUTRAL" - A gender-neutral voice. This voice is not yet supported.SsmlGenderstring `json:"ssmlGender,omitempty"`// ForceSendFields is a list of field names (e.g. "LanguageCodes") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "LanguageCodes") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}Voice: Description of a voice supported by the TTS service.
func (Voice)MarshalJSON¶
typeVoiceCloneParams¶added inv0.200.0
type VoiceCloneParams struct {// VoiceCloningKey: Required. Created by GenerateVoiceCloningKey.VoiceCloningKeystring `json:"voiceCloningKey,omitempty"`// ForceSendFields is a list of field names (e.g. "VoiceCloningKey") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "VoiceCloningKey") to include in// API requests with the JSON null value. By default, fields with empty values// are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}VoiceCloneParams: The configuration of Voice Clone feature.
func (VoiceCloneParams)MarshalJSON¶added inv0.200.0
func (sVoiceCloneParams) MarshalJSON() ([]byte,error)
typeVoiceSelectionParams¶
type VoiceSelectionParams struct {// CustomVoice: The configuration for a custom voice. If// [CustomVoiceParams.model] is set, the service will choose the custom voice// matching the specified configuration.CustomVoice *CustomVoiceParams `json:"customVoice,omitempty"`// LanguageCode: Required. The language (and potentially also the region) of// the voice expressed as a BCP-47// (https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag, e.g. "en-US".// This should not include a script tag (e.g. use "cmn-cn" rather than// "cmn-Hant-cn"), because the script will be inferred from the input provided// in the SynthesisInput. The TTS service will use this parameter to help// choose an appropriate voice. Note that the TTS service may choose a voice// with a slightly different language code than the one selected; it may// substitute a different region (e.g. using en-US rather than en-CA if there// isn't a Canadian voice available), or even a different language, e.g. using// "nb" (Norwegian Bokmal) instead of "no" (Norwegian)".LanguageCodestring `json:"languageCode,omitempty"`// ModelName: Optional. The name of the model. If set, the service will choose// the model matching the specified configuration.ModelNamestring `json:"modelName,omitempty"`// MultiSpeakerVoiceConfig: Optional. The configuration for a Gemini// multi-speaker text-to-speech setup. Enables the use of two distinct voices// in a single synthesis request.MultiSpeakerVoiceConfig *MultiSpeakerVoiceConfig `json:"multiSpeakerVoiceConfig,omitempty"`// Name: The name of the voice. If both the name and the gender are not set,// the service will choose a voice based on the other parameters such as// language_code.Namestring `json:"name,omitempty"`// SsmlGender: The preferred gender of the voice. If not set, the service will// choose a voice based on the other parameters such as language_code and name.// Note that this is only a preference, not requirement; if a voice of the// appropriate gender is not available, the synthesizer should substitute a// voice with a different gender rather than failing the request.//// Possible values:// "SSML_VOICE_GENDER_UNSPECIFIED" - An unspecified gender. In// VoiceSelectionParams, this means that the client doesn't care which gender// the selected voice will have. In the Voice field of ListVoicesResponse, this// may mean that the voice doesn't fit any of the other categories in this// enum, or that the gender of the voice isn't known.// "MALE" - A male voice.// "FEMALE" - A female voice.// "NEUTRAL" - A gender-neutral voice. This voice is not yet supported.SsmlGenderstring `json:"ssmlGender,omitempty"`// VoiceClone: Optional. The configuration for a voice clone. If// [VoiceCloneParams.voice_clone_key] is set, the service chooses the voice// clone matching the specified configuration.VoiceClone *VoiceCloneParams `json:"voiceClone,omitempty"`// ForceSendFields is a list of field names (e.g. "CustomVoice") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.ForceSendFields []string `json:"-"`// NullFields is a list of field names (e.g. "CustomVoice") to include in API// requests with the JSON null value. By default, fields with empty values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}VoiceSelectionParams: Description of which voice to use for a synthesisrequest.
func (VoiceSelectionParams)MarshalJSON¶
func (sVoiceSelectionParams) MarshalJSON() ([]byte,error)
typeVoicesListCall¶
type VoicesListCall struct {// contains filtered or unexported fields}func (*VoicesListCall)Context¶
func (c *VoicesListCall) Context(ctxcontext.Context) *VoicesListCall
Context sets the context to be used in this call's Do method.
func (*VoicesListCall)Do¶
func (c *VoicesListCall) Do(opts ...googleapi.CallOption) (*ListVoicesResponse,error)
Do executes the "texttospeech.voices.list" call.Any non-2xx status code is an error. Response headers are in either*ListVoicesResponse.ServerResponse.Header or (if a response was returned atall) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified tocheck whether the returned error was because http.StatusNotModified wasreturned.
func (*VoicesListCall)Fields¶
func (c *VoicesListCall) Fields(s ...googleapi.Field) *VoicesListCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.
func (*VoicesListCall)Header¶
func (c *VoicesListCall) Header()http.Header
Header returns a http.Header that can be modified by the caller to addheaders to the request.
func (*VoicesListCall)IfNoneMatch¶
func (c *VoicesListCall) IfNoneMatch(entityTagstring) *VoicesListCall
IfNoneMatch sets an optional parameter which makes the operation fail if theobject's ETag matches the given value. This is useful for getting updatesonly after the object has changed since the last request.
func (*VoicesListCall)LanguageCode¶
func (c *VoicesListCall) LanguageCode(languageCodestring) *VoicesListCall
LanguageCode sets the optional parameter "languageCode": Recommended. BCP-47(https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. If notspecified, the API will return all supported voices. If specified, theListVoices call will only return voices that can be used to synthesize thislanguage_code. For example, if you specify "en-NZ", all "en-NZ" voiceswill be returned. If you specify "no", both "no-\*" (Norwegian) and"nb-\*" (Norwegian Bokmal) voices will be returned.
typeVoicesService¶
type VoicesService struct {// contains filtered or unexported fields}funcNewVoicesService¶
func NewVoicesService(s *Service) *VoicesService
func (*VoicesService)List¶
func (r *VoicesService) List() *VoicesListCall
List: Returns a list of Voice supported for synthesis.