Use the Ruby SDK with Qwen-LiveTranslate-Realtime to translate a Chinese recording into English and print the translation.
Prerequisites
Install the Ruby SDK and configure your API key. Replace WorkspaceId with your workspace ID in Singapore and use an API key from the same region.
Quick start
Save the example as example.rb and run ruby example.rb.
SDK reference
| Option | Description |
|---|---|
model, url | Translation model ID and Realtime WebSocket endpoint. |
source_language, target_language | Source and target languages. |
voice | Voice for translated audio. Choose a voice supported by the model. |
connect and use pump to read events. Wait for session.updated before sending audio with append_audio. Read completed translations in on_translation_completed. Call finish to wait for the last segment.
Use 16 kHz, 16-bit, mono raw PCM input. Choose source_language and target_language supported by the selected model.