I'm a beginner in coding. I am using the Google Cloud Text to Speech API for Python on a small program I'm using. The function is working and I get the synthesized voice results, but the MP3 file is different from what I need. I chose 'en-GB-Wavenet-C'(British accent female voice) as language_code, but the MP3 file sounds American accent male voice.
I visited Cloud Text to Speech API website(https://cloud.google.com/text-to-speech/) and tried "Speak it" demo. I tried 'en-GB-Wavenet-C' and it sounded British accent female voice.
I would like to know the appropriate code so that I get 'en-GB-Wavenet-C' voice result.
I use Debian 9.3 from Windows Subsystem for Linux.
I use Google Cloud SDK 210.0.0.
Thank you in advance.
This is my code:
#!/usr/bin/env python from google.cloud import texttospeech client = texttospeech.TextToSpeechClient() with open('resources/hello.ssml', 'r') as f: ssml = f.read() input_text = texttospeech.types.SynthesisInput(ssml=ssml) # Note: the voice can also be specified by name. # Names of voices can be retrieved with client.list_voices(). voice = texttospeech.types.VoiceSelectionParams(language_code='en-GB-Wavenet-C') audio_config = texttospeech.types.AudioConfig( audio_encoding=texttospeech.enums.AudioEncoding.MP3) response = client.synthesize_speech(input_text, voice, audio_config) # The response's audio_content is binary. with open('output.mp3', 'wb') as out: out.write(response.audio_content) print('Audio content written to file "output.mp3"') # [END tts_synthesize_ssml_file]