# Narration audio — rules for Codex agents (Pre-Uni New College Lesson Voice Creator)

All narration for solution videos is made with the **Lesson Voice Creator** (cloned teacher voice).
Never call ElevenLabs, Qwen, Inworld or any other TTS service directly, and never put API keys in code.

## How to make audio

Preferred: the MCP tool `make_narration` (server `preuni_voice` in ~/.codex/config.toml, signed in with `codex mcp login preuni_voice`).

- `voice`: **required.** The saved voice name, e.g. `Suna` for solution videos. Call `list_voices` to see the names. Never guess.
- `code`: the question code used as the file name, e.g. `QID191568`
- `script`: the narration script (rules below). Blank line between paragraphs.
- `pauses`: the sheet's "Thinking pauses" value, e.g. `1.77 s / 1.62 s / 1.70 s` (one per paragraph gap). Optional.
- `check`: `true` for final takes (about $0.002 per minute). The reply starts with one status line:
  - `check: pass`, `check: pass (spelling only)`, `check: pass (recogniser only)`, `check: fault fixed by auto-retake` → **render, no need to ask anyone**.
  - `check: fault remains` → do not render. Each fault gives the paragraph, sentence, time range and reason (missing words / extra sound). Listen there, fix the script if needed, and make it again with `retake: true`; if it still fails, tell Puni.
  A real fault is retaken once automatically; you always get the better take.
- `retake`: `true` makes new audio even when the script is cached (use it after a fault). `force` is only for other cases a person asks for.
- `check_take` with a recording id (`j_…`) re-checks an existing take without making new audio.
- Word timestamps come with every make_narration and check_take (turn off with `word_times: false`): a JSON link with each script word's `start`/`end` (seconds from the start of the delivered MP3; `estimated: true` when the recogniser did not hear that word clearly) and each paragraph's start/end. Use them to time pen marks and highlights to the spoken phrase.
- Lines starting `notes` in the check are not faults; you do not need to listen to them.
- Leave `speed` and `style` out unless a person asked; the studio defaults apply.

The tool returns a download URL (valid 24 h) and **timings**: the start and end second of each paragraph in the MP3.
Save the file with the curl command it gives, and use the timings to place pointers, highlights and ink.
Long narrations are fine: each paragraph is voiced separately, so the voice does not drift.

For a conversation between several voices use `make_dialogue` with lines like `Suna: ...` / `Isabella: ...`.

Without MCP, use the command-line client:

```bash
python lvc_client.py --code QID191568 --text-file script.txt --pauses "1.77 / 1.62 / 1.70" --out audio
python lvc_client.py --batch scripts.csv --out audio
```

## Cost rules

- Every new generation costs money. The same script with the same settings is cached and free.
- **Never use `force`** unless a person asked to regenerate that question.
- Fix the script first, then generate once. Do not try several versions.
- Budget reached (HTTP 402 / exit code 3): stop all audio work and report it.
- Server or token problem (exit code 2): stop and report it. Do not loop.

## How to write the script

The voice reads exactly what you write, so write it the way a teacher says it aloud.

- Plain spoken Australian English, short sentences, no markdown, bullets or emojis.
- Text in `[square brackets]` is a note for people and is never read aloud.
- One blank line between paragraphs. Each paragraph that ends with a question gets a thinking pause after it.
- The server turns digits and symbols into speech for you (and lists what it changed in the reply as "Read as"):
  `704 050` → "seven hundred and four thousand and fifty", `120 m²` → "one hundred and twenty square metres",
  `$9.50` → "nine dollars fifty", `45c` → "forty-five cents", `9:30` → "nine thirty", `AB` → "A B",
  option letters: write a plain capital `A`, `B`… ("A has…", "Choice A,", "the answer is A."). The voice reads a capital A as the letter; do not write "Ay" or "Eh".
  Numbers you already wrote in words are read exactly as written.
- Still write in words where meaning matters, for example:
  `3/4` → "three quarters", `2 1/2` → "two and a half", `$12.50` → "twelve dollars fifty",
  `45%` → "forty-five percent", `x² + 3 = 12` → "x squared plus three equals twelve",
  `3:2` → "three to two", `km/h` → "kilometres per hour", `cm²` → "square centimetres",
  `7:45 am` → "seven forty-five in the morning", option `(C)` → "option C".
- Start directly with the explanation. End with the answer: "The correct answer is C."
