Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
WorkspaceId 替换为同地域的业务空间 ID。
用 longanfengyue_v3.1 音色分段合成两句话,将收到的音频依次写入 output.wav。运行后即可播放该文件。
using DashScope.Speech;
await using var client = new CosyVoiceSpeechSynthesizer(new CosyVoiceSynthesizerOptions
{
Model = "qwen-audio-3.1-tts-flash",
Voice = "longanfengyue_v3.1",
Url = "wss://WorkspaceId.ap-southeast-1.maas.aliyuncs.com/api-ws/v1/inference",
Format = "wav",
SampleRate = 16000,
});
using var output = File.Create("output.wav");
await foreach (var chunk in client.StreamAudioAsync(["今天下午三点开会。", "请提前入场。"]))
{
await output.WriteAsync(chunk);
}