AI agents · Recipes
Voice a scene
Every call for a two-character scene: cast, write, read, check, and hand over in the studio.
A worked example: a two-line exchange between a guard and a thief, voiced, checked and handed to the user in the studio. The call order behind it is in Sequence story calls.
Before you begin
- The agent is connected over Streamable HTTP.
- The user has at least two saved voices, and a text-to-speech model is installed.
Cast the voices
Call
soundbox.list_voiceswith no arguments.The result lists each voice's
id,nameandmodel_id. Choose one for the guard and one for the thief. In the examples that follow,<GUARD_VOICE_ID>and<THIEF_VOICE_ID>stand for those ids.Call
soundbox.list_modelsand find each voice'smodel_id.Its
deliverylist names the performance controls that model takes. A model with no list has none.
Write the script
Call
soundbox.create_storywith a title:soundbox.create_story arguments { "title": "Guard and thief" }Keep the
story_idfrom the result.<STORY_ID>stands for it from here on.Call
soundbox.add_lineswith both lines and a beat between them:soundbox.add_lines arguments { "story_id": "<STORY_ID>", "lines": [ { "speaker": "Guard", "voice_id": "<GUARD_VOICE_ID>", "text": "Who goes there?" }, { "kind": "pause", "duration_s": 0.6 }, { "speaker": "Thief", "voice_id": "<THIEF_VOICE_ID>", "text": "Just the wind." } ] }The result reports
added: 3, twolinesand onepause, withvoiced: 0.To have a line performed a certain way, add a
deliveryobject to it with names from that model'sdeliverylist. Never write the direction intotext:(whispering)is read aloud.
Read it aloud
Call
soundbox.speak_story:soundbox.speak_story arguments { "story_id": "<STORY_ID>" }The call blocks while each line is read on its own voice's model. The result reports
read: 2andmodels, the number of lines each model read.If the result has
notes, tell the user. A note means a voice's model was not installed and another model read the line, so it will not sound like that voice.
Check and hand over
Call
soundbox.get_storywith thestory_id.Both spoken lines show
voiced: true, with aduration_sand astart_sthat follow one another. The pause has no audio of its own, so it showsvoiced: false.Give the user the
open_in_studiolink from any of the results, so they can listen and keep editing.Optional: if the user wants one file, call
soundbox.export_storywith thestory_id. The result is a library sound with an absolutepath.
What's next
- Sequence story calls: adding to a scene that already has audio, rewriting a line, mixing.
- Studio action vocabulary: editing the scene while the user has it open.