Hi,
I am using Google Text to Speech client library according to the following code:
gcp_creds = service_account.Credentials.from_service_account_info()
client = texttospeech.TextToSpeechClient(credentials=gcp_creds)
synthesis_input = texttospeech.SynthesisInput(text=text)
if <insert language detecting logic>:
language = "hi-IN"
else:
language = "en-IN"
voice = texttospeech.VoiceSelectionParams(
language_code=language, name=language + "-Standard-D"
)
audio_config = texttospeech.AudioConfig(
audio_encoding=texttospeech.AudioEncoding.LINEAR16,
sample_rate_hertz=RATE,
speaking_rate=0.9,
pitch=0,
effects_profile_id=["telephony-class-application"],
)
res = client.synthesize_speech(
input=synthesis_input, voice=voice, audio_config=audio_config
)
I'm experiencing very high latency, from 500 ms to 22000 ms. I have tried reducing this using different configurations but was unsuccessful.
How can I reduce latency to below 500 ms?