Use the Ruby SDK with Qwen-Audio-ASR-Streaming to transcribe 16 kHz, 16-bit, mono raw PCM audio.
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 | Model ID and WebSocket endpoint. |
format, sample_rate | Audio format and sample rate. Match the audio input. |
transcribe_pcm_file streams audio at real-time speed and waits for the task to finish. Read finalized sentences in on_sentence_end. To stream frames yourself, call start, send_audio, and stop. Handle task errors in on_failed.
Use connect_timeout, start_timeout, and stop_timeout to control the connection, task startup, and completion. Set format and sample_rate to match your audio.