---
name: tts-foley-batch
description: Generate timed per-beat 48kHz voiceover WAV stems and dry foley SFX via Deepgram Aura-2, Cartesia Sonic-3.6, or ElevenLabs API, enforce uncompressed 48kHz PCM mastering hygiene, log character spend, and report exact ffprobe durations before generating silent AI video clips.
---
# Timed Voiceover & Foley Stem Batch Protocol
Whenever generating narration or sound effects to pair with silent AI video (`Runway Gen-4 Turbo`, `Runway Gen-4.5`, `Alibaba Wan 2.2`), follow this deterministic "cut-to-radio" audio pipeline:
## 1. Route to a Durable REST Voice Engine (Avoid Retiring OpenAI `/v1/audio/speech`)
- **WARNING — OpenAI TTS Deprecation:** OpenAI officially deprecated `gpt-4o-mini-tts`, `tts-1`, and `tts-1-hd` on `/v1/audio/speech` with shutdown scheduled for **January 6, 2027** (pointing to `gpt-realtime-2.1-mini` on the WebSocket/WebRTC Realtime API). Do NOT build new REST batch scripts on `gpt-4o-mini-tts`.
- **Bulk explainers, Reels & pure pay-as-you-go REST -> `Deepgram Aura-2` (`$0.030/1k chars`, `~$0.024/min`):**
- Request `encoding=linear16&container=wav&sample_rate=48000` on `POST https://api.deepgram.com/v1/speak` for native 48 kHz broadcast WAV.
- **Low-latency cloned brand voices (44 languages) -> `Cartesia Sonic-3.6` (`$5/mo` Pro, `~$0.038/min`):**
- Request `48000 Hz` PCM WAV from `/tts/bytes` to avoid MP3 priming offset.
- **Expressive acting nuance or dry spot foley -> `ElevenLabs` (`$0.04` Flash / `$0.08` Expressive per 1k chars):**
- Request `output_format=pcm_44100` (or `mp3_44100_192`).
- Generate tactile spot foley separately via `POST /v1/sound-generation` with `"dry close-mic foley, zero music"` (`200 cr` auto / `40 cr/s` manual / `$0.12/min` API).
## 2. Print Character Count & Cost Before Calling Paid APIs
Count total script characters across all beats, display exact projected cost (`chars / 1000 * $0.030` Deepgram, `chars / 1000 * $0.05` Cartesia Pro, or `chars / 1000 * $0.08` ElevenLabs), and enforce SHA-256 caching on `(engine, voice, settings, text)` so repeated runs never re-bill unchanged beats.
## 3. Mandatory 48 kHz Conform & Head/Tail Pad Hygiene
ElevenLabs defaults to `44.1 kHz` (and legacy OpenAI stems output `24 kHz`). Conform EVERY stem cleanly to `48 kHz` PCM and add `0.25s` clean silence padding before concatenation:
```bash
ffmpeg -y -i raw_beat01.wav -af "aresample=48000,highpass=f=80,apad=pad_dur=0.25" -c:a pcm_s16le stems/beat01_48k.wav
```
## 4. Measure Real Beat Durations with `ffprobe`
Print an exact timing table (`Beat | Words | Actual Duration (s) | Recommended Silent Video Length`) using:
```bash
ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 stems/beat01_48k.wav
```
Round each beat cleanly up to the next whole second your video model supports (Runway Gen-4 Turbo and Gen-4.5 accept any duration from `2s` to `10s`; check the allowed lengths of any other model first) so silent video cuts align seamlessly with natural vocal pauses.