normalize_audio_02 / README.md
toanatp's picture
Upload 4 files
42e907a verified
metadata
title: normalize_audio_02
sdk: docker
app_port: 7860
pinned: false

Audio Normalizer (FastAPI)

Local service for loudness normalization using ffmpeg loudnorm (EBU R128).

Requirements

  • Python 3.10+
  • ffmpeg available in PATH

Setup

cd workers/audio_normalizer
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

Run

uvicorn app:app --host 0.0.0.0 --port 8081

Test (PowerShell)

$form = @{ audio = Get-Item "C:\path\to\input.wav" }
Invoke-RestMethod `
  -Uri "http://localhost:8081/normalize?target_lufs=-16&true_peak=-1.0&lra=11" `
  -Method Post `
  -Form $form `
  -OutFile "normalized.wav"

Notes

  • Output is WAV by default. Use output_format=mp3 to return MP3.
  • Headers include measured loudness and applied gain:
    • X-Input-LUFS, X-Input-TP, X-Input-LRA, X-Target-LUFS, X-Applied-Gain

Optional auth

  • Set NORMALIZE_WORKER_AUTH_KEY (or reuse TTS_WORKER_AUTH_KEY) to require x-worker-auth header.