Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
WorkspaceId 替換為同一地域的業務空間 ID。
使用 longanyang 音色分段合成兩句話,將收到的音訊依序寫入 output.wav。執行完畢後即可播放。
using DashScope.Speech;
await using var client = new CosyVoiceSpeechSynthesizer(new CosyVoiceSynthesizerOptions
{
Model = "cosyvoice-v3-plus",
Voice = "longanyang",
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);
}