{"slug": "adding-qwen-audio-3-1-and-realtime-voice-conversation-to-sayneat", "title": "Adding Qwen-Audio 3.1 and realtime voice conversation to sayneat", "summary": "A developer added Qwen-Audio 3.1 to the open-source sayneat voice project as a new remote provider slug, qwen3.1, covering speech synthesis, transcription, streaming ASR, voice cloning and full-duplex realtime voice conversations over QwenCloud's DashScope HTTP and WebSocket APIs, while leaving the existing local qwen3 backend untouched. The integration was validated only with unit tests and local mock HTTP and WebSocket servers, and the developer reports no live calls against QwenCloud with a real DASHSCOPE_API_KEY, so no firsthand latency numbers or listening comparisons exist yet. Qwen-Audio 3.1 has no public weights, unlike the local Apache-2.0 Qwen3-TTS-12Hz-1.7B-Base and Qwen3-ASR-0.6B models, and the realtime model raises the context window from 40,960 to 262,144 tokens versus qwen-audio-3.0-realtime-flash.", "body_md": "# Adding Qwen-Audio 3.1 and realtime voice conversation to sayneat\n\nI added Qwen-Audio 3.1 to sayneat for speech synthesis, transcription, streaming ASR, voice cloning, and full-duplex realtime voice conversations over QwenCloud.\n\n- Published\n- Reading time\n- 8 min read\n\nI 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](https://gitlab.com/parlant-co/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.\n\nThat 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.\n\nI 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.\n\n## What changed from Qwen3 to Qwen-Audio 3.1\n\nIn 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.\n\nQwen-Audio 3.1 moves all three jobs to QwenCloud and expands the feature set across each one.\n\nFor 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).\n\nFor 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.\n\nThe 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.\n\n## Native Rust transport and shared live audio\n\nsayneat 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.\n\nEvery 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.\n\nFor 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.\n\nFor 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.\n\nFor 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.\n\n## Full-duplex conversation in the terminal\n\nBecause 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.\n\nWhen 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.\n\nVoice 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.\n\n## Command examples\n\nSet your regional key once in the shell:\n\n```\nexport DASHSCOPE_API_KEY='sk-...'\n```\n\nList the 84 Singapore system voices without touching the network (enrolled custom voices appear too when the key is set):\n\n```\nsayneat --voices --model qwen3.1\n```\n\nStream speech directly to your speakers or write a file:\n\n```\nsayneat --realtime --model qwen3.1 --voice Emily_v3.1 \\\n  \"The build finished. You can stop checking the terminal.\"\n\nsayneat --model qwen3.1 --voice qwen-audio-3.1-tts-flash-lerche_de \\\n  --language de --out gruss.wav \"Guten Morgen.\"\n```\n\nTranscribe a recording with hotwords and speaker labels, or follow a live macOS audio input:\n\n```\nsayneat --transcribe --transcribe-model qwen3.1 \\\n  --diarize --terms 'sayneat,QwenCloud' --transcript-format markdown meeting.wav\n\nsayneat --realtime --transcribe --transcribe-model qwen3.1 \\\n  --input-device \"Meeting Mix\" | tee live.txt\n```\n\nStart a live full-duplex voice conversation:\n\n```\nsayneat --realtime --converse --model qwen3.1 \\\n  --language de --instructions \"Answer briefly and plainly.\"\n```\n\n## Current boundaries\n\nLive 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.\n\nFor earlier background on how sayneat handles local and remote backends, see [I replaced macOS say with local neural speech](https://www.lukasrieder.com/blog/i-replaced-macos-say-with-local-neural-speech/) and [I added OmniVoice to sayneat live at Elixir Berlin](https://www.lukasrieder.com/blog/omnivoice-at-elixir-berlin/). Full Qwen-Audio 3.1 parameters and endpoint details live in the [sayneat model guide](https://gitlab.com/parlant-co/sayneat/-/blob/main/docs/models/qwen3.1.md).", "url": "https://wpnews.pro/news/adding-qwen-audio-3-1-and-realtime-voice-conversation-to-sayneat", "canonical_source": "https://www.lukasrieder.com/blog/qwen-audio-3-1-in-sayneat/", "published_at": "2026-11-27 19:00:00+00:00", "updated_at": "2026-11-28 02:41:48.675671+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-tools", "developer-tools", "natural-language-processing"], "entities": ["Qwen-Audio 3.1", "sayneat", "QwenCloud", "DashScope", "Qwen3-TTS-12Hz-1.7B-Base", "Qwen3-ASR-0.6B", "qwen-audio-3.1-realtime-flash", "Hugging Face"], "also_reported_by": [], "takeaway": "Qwen-Audio 3.1 has no public weights, so sayneat added it as an opt-in remote provider (qwen3.1) over DashScope HTTP and WebSocket APIs rather than a drop-in local checkpoint, with TTS billed at $0.23 per million input and $1.87 per million output tokens and ASR at $0.15 and $0.47 per million tokens", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/adding-qwen-audio-3-1-and-realtime-voice-conversation-to-sayneat", "markdown": "https://wpnews.pro/news/adding-qwen-audio-3-1-and-realtime-voice-conversation-to-sayneat.md", "text": "https://wpnews.pro/news/adding-qwen-audio-3-1-and-realtime-voice-conversation-to-sayneat.txt", "jsonld": "https://wpnews.pro/news/adding-qwen-audio-3-1-and-realtime-voice-conversation-to-sayneat.jsonld"}}