# Do a sound pass for a game

A worked example: an agent reads a game's code, lists every event that needs a sound, makes each one with Mirli, and
wires the files in. The bundled `soundbox-sound-pass` skill teaches the same method; see
[Skills and call logs](https://mirli.app/docs/mcp-skills/index.md#skills).

## Before you begin

- The agent is connected to Mirli and can read and write the game's files.
- At least one sound-effect model is installed: `list_models` shows one with `task: "gen"` and `status` installed or
  loaded.

## List the events

1. Read the game's code and design notes, and list every moment that should make a sound: player actions, impacts,
   pickups, UI, and ambience for each level.
2. For each event, write down a file name, a length and a physical description of the sound.

   For example:

   ```text
   door_open      1.5 s  heavy wooden door creaking open, iron hinges
   coin_pickup    0.5 s  small bright metallic coin chime, close
   cave_ambience  20 s   dripping water in a large stone cave, distant wind
   ```

3. Show the list to the user before generating, so they can add or remove events.

## Choose a model

1. Call `soundbox.list_models`.
2. Pick a model whose `task` is `gen` and whose `max_duration_s` covers the longest event.

   If the game is commercial, pick one whose `commercial_use` is `yes`. A model marked `no` has a licence that forbids
   commercial use.

3. Optional: call `soundbox.list_sounds` with `q` set to each event. A sound already in the library can be reused.

## Make the sounds

1. For each event, call `soundbox.generate` with its description, its length and two or three takes:

   ```json title="soundbox.generate arguments"
   {
     "prompt": "heavy wooden door creaking open, iron hinges",
     "duration_s": 1.5,
     "variations": 3,
     "tags": ["door_open", "sound-pass"]
   }
   ```

   The call blocks until the files exist. Each of the result's `sounds` has an absolute `path`.

2. Pick one take per event, or keep all of them as variants if the game plays a random one.

   Mirli renders one job at a time, so call `generate` once per event rather than in parallel.

3. Copy each chosen file into the game's sound folder under the event's file name.

## Wire them in

1. Add each file to the game's audio code where its event fires, the same way the code already plays sounds.
2. Give the user the list of events, the files and the model used, including its licence.

## What's next

- [Troubleshoot agent calls](https://mirli.app/docs/agents-troubleshooting/index.md): what to do when `generate` fails.
- [Sound tools](https://mirli.app/docs/mcp-sounds/index.md): every argument of `generate`.
