audio-normalizer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Audio Normalizer

音频标准化器

Normalize audio volume levels using peak or RMS normalization to ensure consistent loudness across files.
使用峰值或RMS标准化来统一音频音量,确保多个文件的响度一致。

Purpose

用途

Volume normalization for:
  • Podcast episode consistency
  • Music playlist leveling
  • Speech recording standardization
  • Broadcast loudness compliance
音量标准化适用于:
  • 播客剧集音量一致性
  • 音乐播放列表音量均衡
  • 语音录制标准化
  • 广播响度合规性

Features

功能特性

  • Peak Normalization: Normalize to maximum peak level (dBFS)
  • RMS Normalization: Normalize to average loudness level
  • Loudness Matching: Match LUFS target for broadcast compliance
  • Batch Processing: Normalize multiple files to same level
  • Format Preservation: Maintain original audio format
  • Headroom Control: Prevent clipping with configurable headroom
  • 峰值标准化:将音频标准化至最大峰值电平(dBFS)
  • RMS标准化:将音频标准化至平均响度电平
  • 响度匹配:匹配LUFS目标以符合广播合规要求
  • 批量处理:将多个文件标准化至同一电平
  • 格式保留:保持原始音频格式
  • 余量控制:通过可配置的余量防止削波

Quick Start

快速开始

python
from audio_normalizer import AudioNormalizer
python
from audio_normalizer import AudioNormalizer

Peak normalization to -1 dBFS

Peak normalization to -1 dBFS

normalizer = AudioNormalizer() normalizer.load('input.mp3') normalizer.normalize_peak(target_dbfs=-1.0) normalizer.save('normalized.mp3')
normalizer = AudioNormalizer() normalizer.load('input.mp3') normalizer.normalize_peak(target_dbfs=-1.0) normalizer.save('normalized.mp3')

RMS normalization for consistent average loudness

RMS normalization for consistent average loudness

normalizer.normalize_rms(target_dbfs=-20.0) normalizer.save('normalized_rms.mp3')
normalizer.normalize_rms(target_dbfs=-20.0) normalizer.save('normalized_rms.mp3')

Batch normalize all files to same level

Batch normalize all files to same level

normalizer.batch_normalize( input_files=['audio1.mp3', 'audio2.mp3'], output_dir='normalized/', method='rms', target_dbfs=-20.0 )
undefined
normalizer.batch_normalize( input_files=['audio1.mp3', 'audio2.mp3'], output_dir='normalized/', method='rms', target_dbfs=-20.0 )
undefined

CLI Usage

命令行界面(CLI)使用方法

bash
undefined
bash
undefined

Peak normalization

Peak normalization

python audio_normalizer.py input.mp3 --output normalized.mp3 --method peak --target -1.0
python audio_normalizer.py input.mp3 --output normalized.mp3 --method peak --target -1.0

RMS normalization

RMS normalization

python audio_normalizer.py input.mp3 --output normalized.mp3 --method rms --target -20.0
python audio_normalizer.py input.mp3 --output normalized.mp3 --method rms --target -20.0

Batch normalize directory

Batch normalize directory

python audio_normalizer.py *.mp3 --output-dir normalized/ --method rms --target -20.0
python audio_normalizer.py *.mp3 --output-dir normalized/ --method rms --target -20.0

Show current levels without normalizing

Show current levels without normalizing

python audio_normalizer.py input.mp3 --analyze-only
undefined
python audio_normalizer.py input.mp3 --analyze-only
undefined

API Reference

API 参考

AudioNormalizer

AudioNormalizer

python
class AudioNormalizer:
    def load(self, filepath: str) -> 'AudioNormalizer'
    def normalize_peak(self, target_dbfs: float = -1.0, headroom: float = 0.1) -> 'AudioNormalizer'
    def normalize_rms(self, target_dbfs: float = -20.0) -> 'AudioNormalizer'
    def analyze_levels(self) -> Dict[str, float]
    def save(self, output: str, format: str = None, bitrate: str = '192k') -> str
    def batch_normalize(self, input_files: List[str], output_dir: str,
                       method: str = 'rms', target_dbfs: float = -20.0) -> List[str]
python
class AudioNormalizer:
    def load(self, filepath: str) -> 'AudioNormalizer'
    def normalize_peak(self, target_dbfs: float = -1.0, headroom: float = 0.1) -> 'AudioNormalizer'
    def normalize_rms(self, target_dbfs: float = -20.0) -> 'AudioNormalizer'
    def analyze_levels(self) -> Dict[str, float]
    def save(self, output: str, format: str = None, bitrate: str = '192k') -> str
    def batch_normalize(self, input_files: List[str], output_dir: str,
                       method: str = 'rms', target_dbfs: float = -20.0) -> List[str]

Normalization Methods

标准化方法

Peak Normalization

峰值标准化

  • Scales audio so highest peak reaches target level
  • Preserves dynamic range
  • Good for preventing clipping
  • Target: typically -1.0 to -3.0 dBFS
  • 调整音频音量,使最高峰值达到目标电平
  • 保留动态范围
  • 适合防止削波
  • 目标值:通常为-1.0至-3.0 dBFS

RMS Normalization

RMS标准化

  • Scales audio so average level reaches target
  • Better for perceived loudness matching
  • Good for podcasts and speech
  • Target: typically -20.0 to -23.0 dBFS
  • 调整音频音量,使平均电平达到目标值
  • 更适合匹配感知响度
  • 适合播客和语音内容
  • 目标值:通常为-20.0至-23.0 dBFS

LUFS Matching

LUFS匹配

  • Integrated Loudness Units relative to Full Scale
  • Broadcast standard (EBU R128, ITU BS.1770)
  • Target: -23 LUFS (broadcast), -16 LUFS (streaming)
  • 相对于满刻度的综合响度单位(Integrated Loudness Units relative to Full Scale)
  • 广播标准(EBU R128、ITU BS.1770)
  • 目标值:-23 LUFS(广播)、-16 LUFS(流媒体)

Best Practices

最佳实践

For Podcasts:
python
normalizer.normalize_rms(target_dbfs=-19.0)  # Speech clarity
For Music:
python
normalizer.normalize_peak(target_dbfs=-1.0)  # Preserve dynamics
For Broadcast:
python
normalizer.normalize_rms(target_dbfs=-23.0)  # EBU R128 compliance
对于播客:
python
normalizer.normalize_rms(target_dbfs=-19.0)  # 提升语音清晰度
对于音乐:
python
normalizer.normalize_peak(target_dbfs=-1.0)  # 保留动态范围
对于广播:
python
normalizer.normalize_rms(target_dbfs=-23.0)  # 符合EBU R128标准

Use Cases

使用场景

  • Podcast Production: Consistent volume across episodes
  • Music Playlists: Even loudness for continuous playback
  • Audiobooks: Standardized narration levels
  • Conference Recordings: Normalize different speakers
  • Video Production: Match audio levels before mixing
  • 播客制作:各集之间保持一致音量
  • 音乐播放列表:连续播放时响度均衡
  • 有声书:标准化旁白音量
  • 会议录音:统一不同发言者的音量
  • 视频制作:混音前匹配音频电平

Limitations

局限性

  • Does not apply dynamic compression (use separate compressor)
  • Does not remove DC offset (pre-processing recommended)
  • Peak normalization won't match perceived loudness
  • Doesn't fix clipped audio (distortion is permanent)
  • 不支持动态压缩(需使用单独的压缩工具)
  • 无法消除直流偏移(建议预处理)
  • 峰值标准化无法匹配感知响度
  • 无法修复已削波的音频(失真不可逆)