使用方法 Gemini 3.8 Flash TTS
-
定义说话者: 在其中为每种声音添加一项 speakers 列表。为每位说话者设置 speaker_id in "Speaker N" 格式,选择 voice_name, ,并设置 accent, style, and pace. 还可添加 audio_profile 用于描述人物设定。
-
编写对话: 在 dialogue_turns 中填写按顺序排列的台词。 每轮对话的 speaker_id 必须与已定义的说话者匹配。 可在文本中直接插入语气标签,例如 [whispers], [shouting], or [determination].
-
设置氛围(可选): 使用 scene 描述声音环境,并使用 sample_context 设置整体旁白基调。 调整 temperature (0-2) 以控制表达变化程度。
-
提交并轮询: POST 请求,然后轮询 /predictions/{request_id}/result 直到状态变为 completed 以获取音频 URL。
curl -X POST https://api.muapi.ai/api/v1/gemini-3-8-flash-tts \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"speakers": [
{"speaker_id": "Speaker 1", "voice_name": "Fenrir", "accent": "British (RP)", "style": "Deadpan", "pace": "Natural"},
{"speaker_id": "Speaker 2", "voice_name": "Puck", "accent": "American (Gen)", "style": "Empathetic", "pace": "Staccato"}
],
"dialogue_turns": [
{"speaker_id": "Speaker 1", "text": "[shouting] Halt, traveler!"},
{"speaker_id": "Speaker 2", "text": "[determination] I carry a message for the elder."}
],
"scene": "A dark, crumbling dungeon.",
"temperature": 1
}'