Team Ai
Apppublic

toanatp/normalize_audio_02

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
App README

Audio Normalizer (FastAPI)

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

Requirements

  • —Python 3.10+
  • —ffmpeg available in PATH

Setup

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

Run

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

Test (PowerShell)

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.