---
name: elevenlabs-isolation-acx-master
description: Automate speech denoising and broadcast mastering via ElevenLabs Audio Isolation on fal.ai (fal-ai/elevenlabs/audio-isolation at $0.10/min accepting audio_url or video_url) paired with tested FFmpeg mastering chains for Amazon ACX audiobooks (-18 to -23 dB RMS, <=-3.0 dB peak via alimiter=limit=0.69, <-60 dB floor, 44.1 kHz 192k CBR MP3) and Podcast RSS (-16 LUFS stereo). Use when cleaning echoey interviews, preparing voice-cloning reference samples, or passing ACX audio QA.
---

# ElevenLabs Audio Isolation & ACX / Podcast Mastering Skill

## 1. Pre-Flight Billing & Safety Rules
- **Endpoint:** `fal-ai/elevenlabs/audio-isolation` bills **`$0.10` per input audio minute** (`$1.00` per 10 min; `$6.00` per hour). Measure duration first via `ffprobe` and warn the user to trim unused dead pre-roll before uploading long raw files.
- Accepts either `"audio_url"` (WAV/MP3/M4A) OR `"video_url"` (MP4/MOV) directly.
- **Warning:** Never run Audio Isolation on a track that already contains desired intro music or foley—it removes all non-speech sound. Always isolate raw speech FIRST, then mix music afterward.

## 2. Step 1 — Isolate Dry Speech ($0.10/min)
```bash
curl -sS -X POST "https://fal.run/fal-ai/elevenlabs/audio-isolation" \
  -H "Authorization: Key $FAL_KEY" \
  -H "Content-Type: application/json" \
  -d '{"audio_url":"'"$AUDIO_URL"'"}'
```
*(Swap `"audio_url"` to `"video_url"` when cleaning a raw Zoom or camera MP4 directly.)*

## 3. Step 2 — Master to Exact Distribution Spec (CRITICAL: Resample AFTER loudnorm!)
`loudnorm` internally upsamples to 192 kHz—ALWAYS place `aresample=44100` AND `-ar 44100` AFTER `loudnorm`, and pass `-write_xing 0` for strict CBR MP3 headers:

- **Amazon ACX Audiobook Master (-20 dB RMS target, <=-3.2 dB peak, 44.1 kHz 192k CBR Mono):**
  ```bash
  ffmpeg -y -i isolated.wav \
    -af "highpass=f=80,loudnorm=I=-20:TP=-3.2:LRA=7,alimiter=limit=0.69:attack=5:release=50,aresample=44100" \
    -ar 44100 -ac 1 -c:a libmp3lame -b:a 192k -write_xing 0 chapter_acx_44k.mp3
  ```
- **Podcast RSS Master (-16 LUFS stereo, -1.0 dBTP, 44.1 kHz 192k CBR Stereo):**
  ```bash
  ffmpeg -y -i isolated.wav \
    -af "highpass=f=80,loudnorm=I=-16:TP=-1.0:LRA=9,aresample=44100" \
    -ar 44100 -ac 2 -c:a libmp3lame -b:a 192k -write_xing 0 episode_rss_44k.mp3
  ```

## 4. Step 3 — Mandatory Verification Gate (`ffprobe` + `astats`)
```bash
ffprobe -v error -select_streams a:0 -show_entries stream=sample_rate,channels,bit_rate -of compact=p=0 "$OUT_MP3"
ffmpeg -i "$OUT_MP3" -af "astats=metadata=0:reset=0" -f null - 2>&1 | grep -E "RMS level dB|Peak level dB"
```
Confirm `sample_rate=44100`, `bit_rate=192000`, and for ACX confirm RMS sits inside `-23.0` to `-18.0 dB` with Peak strictly `<= -3.0 dB` (plus 0.5–1s head and 1–5s tail room tone).
