// Perform the text-to-speech request on the text input with the selected // voice parameters and audio file type. req := texttospeechpb.SynthesizeSpeechRequest{ // Set the text input to be synthesized. Input: &texttospeechpb.SynthesisInput{ InputSource: &texttospeechpb.SynthesisInput_Text{Text: text}, }, // Build the voice request, select the language code ("en-US") and the SSML // voice gender ("neutral"). Voice: &texttospeechpb.VoiceSelectionParams{ LanguageCode: "en-US", SsmlGender: texttospeechpb.SsmlVoiceGender_NEUTRAL, }, // Select the type of audio file you want returned. AudioConfig: &texttospeechpb.AudioConfig{ AudioEncoding: texttospeechpb.AudioEncoding_MP3, }, }