I’m building a real-time bidirectional phone translation system using Google Cloud.
I use Google Speech-to-Text (streaming) to transcribe one caller, Translation API to translate, and Text-to-Speech (LINEAR16, 8000Hz) to synthesize audio for the other caller. The audio is streamed to Asterisk via AudioSocket in 320-byte frames every 20ms.
The translation logic works correctly in both directions. The problem is audio quality: the synthesized Text-to-Speech audio plays back choppy and slow — words are cut up and stretched.
A one-directional voice bot using nearly identical code sounds perfectly smooth. The choppiness only appears when handling two simultaneous streams in the same Node.js process.
I have already verified: sample rate is 8000Hz, codec is slin on both legs, CPU is near 0%, and Text-to-Speech latency is about 1.5 seconds. I also tried different frame sizes, jitter buffering, and clock-based pacing — with no improvement.
My questions:
- Is there a recommended way to stream Google Text-to-Speech audio for two simultaneous real-time directions without choppiness?
- Could the issue be related to how Google Text-to-Speech streaming output is chunked or paced?
- Is there a better Google Cloud approach (for example, a different API or streaming method) for low-latency bidirectional voice translation?
Thank you.