Cách sử dụng Gemini 3.8 Flash TTS
-
Khai báo người nói: Add one entry per voice to the speakers list. Give each a speaker_id in "Speaker N" format, pick a voice_name, and set the accent, style, and pace. Optionally add an audio_profile describing the persona.
-
Viết hội thoại: Fill dialogue_turns with ordered lines. Each turn's speaker_id must match a speaker you defined. You can embed tone tags inline such as [whispers], [shouting], hoặc [determination].
-
Thiết lập không khí (không bắt buộc): Use scene to describe the acoustic setting and sample_context to set the overall narration tone. Adjust temperature (0-2) for more hoặc less varied delivery.
-
Gửi yêu cầu và kiểm tra trạng thái: POST the request, then poll /predictions/{request_id}/result until the status is completed to get the audio 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
}'