I added Qwen-Audio 3.1 to sayneat for speech synthesis, transcription, streaming ASR, voice cloning, and full-duplex realtime voice conversations over QwenCloud.
- Published
- Reading time
- 8 min read
I saw a LinkedIn post announcing Qwen-Audio 3.1 across three endpoints: ASR, TTS, and Realtime. My first assumption was that this was a drop-in checkpoint upgrade for the local qwen3 backend in sayneat. Checking Hugging Face and QwenCloud cleared that up quickly. Qwen-Audio 3.1 has no public weights. It is a cloud-hosted model family on QwenCloud, reached over DashScope HTTP and WebSocket APIs.
That changed the integration shape, so I kept the existing local qwen3 slug untouched and added qwen3.1 as an explicit remote provider. Like OpenAI, ElevenLabs, and Inworld, it never runs unless selected by flag or configuration.
I validated the protocol, CLI routing, chunking, audio decoding, and streaming message parsers with unit tests and local mock HTTP and WebSocket servers. I have not yet run live calls against QwenCloud with a real DASHSCOPE_API_KEY, so I have no firsthand latency numbers or listening comparisons to report yet.
What changed from Qwen3 to Qwen-Audio 3.1 #
In sayneat, qwen3 names two open-weight Apache-2.0 models that run locally. Qwen3-TTS-12Hz-1.7B-Base runs in Rust through MLX on Apple Silicon, requires a 3 to 15 second voice clone, and supports ten languages. Qwen3-ASR-0.6B runs on CPU through sherpa-onnx in int8 quantization, handles automatic multilingual recognition, and accepts comma-separated terminology hints, while leaving diarization to a separate local pyannote and 3D-Speaker pipeline.
Qwen-Audio 3.1 moves all three jobs to QwenCloud and expands the feature set across each one.
For speech synthesis, qwen-audio-3.1-tts-flash replaces clone-only usage with a catalog of system voices alongside remote voice cloning. In the Singapore region (ap-southeast-1), the official voice list exposes 84 system voices: four multilingual and Chinese-dialect voices (longanhuan_v3.1, longanlingxin_v3.1, longanfengyue_v3.1, xunanchuan_v3.1), 15 English voices, and 65 dedicated language voices spanning European, Asian, Middle Eastern, and African languages. Upstream documentation adds natural-language style instructions, inline emotion and nonverbal tags such as [whispers] and [sighing], word-level timestamps on streaming responses, and better robustness when cloning from noisy or reverberant clips. Pricing also moved from per-character billing on qwen-audio-3.0-tts-flash ($0.15 per 10,000 characters in Singapore) to token billing on qwen-audio-3.1-tts-flash ($0.23 per million input tokens and $1.87 per million output tokens).
For speech recognition, qwen-audio-3.1-asr-flash expands language coverage beyond the 30 languages of qwen-audio-3.0-asr-flash and adds built-in speaker diarization (speaker_diarization_enabled), dialect preservation ( keep_dialect), native text polishing, and weighted instant hotwords ( parameters.vocabulary) with weights from 1 to 5 or super-hotword weight 50. The synchronous HTTP endpoint handles recordings up to five minutes and bills by tokens ($0.15 per million input tokens and $0.47 per million output tokens in Singapore) instead of per-second duration. The companion streaming model, qwen-audio-3.1-asr-flash-streaming, accepts live 16 kHz mono PCM over WebSocket with hotwords, language hints, and heartbeat packets.
The largest jump is qwen-audio-3.1-realtime-flash, which has no local equivalent in qwen3. It is a full-duplex speech-to-speech model over WebSocket. 16 kHz PCM audio goes up from the microphone while 24 kHz PCM replies stream back in parallel, along with transcripts for both sides. Compared with qwen-audio-3.0-realtime-flash, QwenCloud’s model cards raise the context window from 40,960 tokens to 262,144 tokens (245,760 input and 16,384 output), add Thai, Vietnamese, and Arabic to reach 14 spoken languages alongside 20 Chinese varieties, introduce smart_turn_v2 turn detection with optional speaker enhancement, and keep the Singapore audio rates at $0.93 per million input tokens and $1.87 per million output tokens.
Native Rust transport and shared live audio #
sayneat already had a remote realtime provider in Inworld, which meant tokio-tungstenite, reqwest, CoreAudio capture through rodio, and a streaming 24 kHz playback queue were already in the binary. I pulled the live PCM playback queue, microphone capture, linear resampler, and raw PCM stdin reader out of src/inworld.rs into a shared src/live_audio.rs module, then built src/qwen31.rs on top of it without adding a single crate dependency.
Every Qwen-Audio 3.1 mode runs natively inside the Rust executable over the regional endpoints documented by QwenCloud. DASHSCOPE_API_KEY authenticates requests with a Bearer header and is never saved to config.toml. Because QwenCloud keys are region-scoped, sayneat defaults to Singapore (ap-southeast-1) and reads DASHSCOPE_REGION when you want Beijing (cn-beijing) or another region. DASHSCOPE_BASE_URL lets tests or proxies override the host.
For synthesis, sayneat --model qwen3.1 connects to /api-ws/v1/inference, sends run-task with format: "pcm", sample_rate: 24000, and word_timestamp_enabled: true, waits for task-started, sends continue-task and finish-task, and decodes the incoming binary PCM frames as they arrive. Passing --realtime feeds those samples straight to the audio output as chunks land. Omitting --realtime assembles them into sayneat’s temporary PCM file for file export or interactive word-highlighted playback.
For offline transcription, sayneat --transcribe --transcribe-model qwen3.1 decodes the recording to 16 kHz mono, splits long files on quiet boundaries under the five-minute API cap, encodes each window as a Base64 WAV data URI, and posts it to /api/v1/services/aigc/multimodal-generation/generation. --terms and --terms-file map directly to parameters.vocabulary at weight 5. --diarize enables server-side speaker diarization and intentionally omits language_hints, matching QwenCloud’s documented constraint.
For live transcription, sayneat --realtime --transcribe --transcribe-model qwen3.1 opens the duplex WebSocket to qwen-audio-3.1-asr-flash-streaming, streams 100 ms chunks of 16 kHz mono PCM from CoreAudio or raw PCM stdin, ignores heartbeats and partial hypotheses, and flushes each finalized sentence to stdout as plain text or JSONL.
Full-duplex conversation in the terminal #
Because Qwen-Audio 3.1 includes a speech-to-speech realtime endpoint, I added --realtime --converse to sayneat. It connects to /api-ws/v1/realtime?model=qwen-audio-3.1-realtime-flash, sends session.update with server_vad and the selected voice (defaulting to longanqian_v3.1), and streams 16 kHz microphone audio in input_audio_buffer.append events.
When the model responds, response.audio.delta frames decode directly into the live 24 kHz player. If the server sends input_audio_buffer.speech_started while audio is still playing, sayneat clears the local playback queue so you can interrupt mid-sentence. Completed transcripts for both turns write to stdout as [You] and [AI] lines, or to --out if you want a log.
Voice cloning also carries over to the remote model. Running --model qwen3.1 --clone prepares a 3 to 20 second 24 kHz mono clip, submits it to /api/v1/services/audio/tts/customization with target_model: "qwen-audio-3.1-tts-flash", polls query_voice until the status reaches OK, and prints the provider voice ID.
Command examples #
Set your regional key once in the shell:
export DASHSCOPE_API_KEY='sk-...'
List the 84 Singapore system voices without touching the network (enrolled custom voices appear too when the key is set):
sayneat --voices --model qwen3.1
Stream speech directly to your speakers or write a file:
sayneat --realtime --model qwen3.1 --voice Emily_v3.1 \
"The build finished. You can stop checking the terminal."
sayneat --model qwen3.1 --voice qwen-audio-3.1-tts-flash-lerche_de \
--language de --out gruss.wav "Guten Morgen."
Transcribe a recording with hotwords and speaker labels, or follow a live macOS audio input:
sayneat --transcribe --transcribe-model qwen3.1 \
--diarize --terms 'sayneat,QwenCloud' --transcript-format markdown meeting.wav
sayneat --realtime --transcribe --transcribe-model qwen3.1 \
--input-device "Meeting Mix" | tee live.txt
Start a live full-duplex voice conversation:
sayneat --realtime --converse --model qwen3.1 \
--language de --instructions "Answer briefly and plainly."
Current boundaries #
Live microphone capture in --realtime --transcribe and --realtime --converse is currently macOS-only, matching Inworld’s CoreAudio capture support. Using qwen3.1 sends text, recordings, or live audio to QwenCloud under your account’s region and billing terms. Network drops end the active session without automatic reconnection.
For earlier background on how sayneat handles local and remote backends, see I replaced macOS say with local neural speech and I added OmniVoice to sayneat live at Elixir Berlin. Full Qwen-Audio 3.1 parameters and endpoint details live in the sayneat model guide.