It seems like something happened to using SsmlVoiceGender.Male or SsmlVoiceGender.Female to select the gender of a voice. Now for Chinese Traditional it only picks a female voice. For Spanish it only picks a male voice, regardless of the SsmlGender setting. Did something change? Do I need to specify a voice name? My code:
string languageCode = languageID.LanguageCultureExtensionCode;
double speakingRate = RateTable[Speed + 10];
TextToSpeechClientBuilder builder = new TextToSpeechClientBuilder
{
CredentialsPath = GoogleUtilities.GetGoogleKeyPath()
};
TextToSpeechClient client = builder.Build();
// The input can be provided as text or SSML.
SynthesisInput input = new SynthesisInput
{
Text = text
};
// You can specify a particular voice, or ask the server to pick based
// on specified criteria.
VoiceSelectionParams voiceSelection = new VoiceSelectionParams
{
LanguageCode = languageCode,
SsmlGender = (VoiceName == "Google Female"
? SsmlVoiceGender.Female
: SsmlVoiceGender.Male)
};
// The audio configuration determines the output format and speaking rate.
AudioConfig audioConfig = new AudioConfig
{
AudioEncoding = AudioEncoding.Mp3,
SampleRateHertz = 44100,
SpeakingRate = speakingRate
};
try
{
SynthesizeSpeechResponse response = client.SynthesizeSpeech(input, voiceSelection, audioConfig);
...
Someone posted this to Stack Overflow, which didn’t get a response I could use: https://stackoverflow.com/questions/74718704/google-text-to-speech-api-always-translates-text-with-female-voice