Professional-grade audio analysis tool with EBU R128 loudness measurement
Project description
rs_audio_stats
Professional-grade audio analysis tool with EBU R128 loudness measurement for Python.
概要
rs_audio_statsは、EBU R128標準(ITU-R BS.1770-4)に準拠したラウドネス測定、真のピーク検出、RMS計算、音声正規化機能を提供する包括的な音声解析ライブラリです。
インストール
pip install rs_audio_stats
クイックスタート
import rs_audio_stats as ras
# 音声ファイルを解析
info, results = ras.analyze_audio("audio.wav", True, False, False, False, True, False, False)
print(f"統合ラウドネス: {results.integrated_loudness:.1f} LUFS")
print(f"真のピーク: {results.true_peak:.1f} dBFS")
# ディレクトリの一括解析
results = ras.batch_analyze_directory("audio_folder/", True, False, False, False, True, False, False)
for file_path, (info, analysis) in results.items():
print(f"{file_path}: {analysis.integrated_loudness:.1f} LUFS")
📖 完全ドキュメント
COMPLETE_API_REFERENCE.md で全機能の詳細な使用方法とサンプルコードをご覧いただけます。
Core Features
📊 Audio Information
- ✅ Sample rate, channels, bit depth (-sr, -ch, -bt)
- ✅ Duration in seconds and formatted time (-du, -tm)
- ✅ Total samples and format detection (-f, -fe, -fea)
🎚️ Loudness Analysis (EBU R128)
- ✅ Integrated loudness measurement (-i)
- ✅ Short-term loudness (-s)
- ✅ Momentary loudness (-m)
- ✅ Loudness range (LRA) (-l)
- ✅ True peak detection (-tp)
- ✅ RMS maximum and average (-rm, -ra)
🎛️ Audio Normalization
- ✅ True peak normalization (-norm-tp)
- ✅ Integrated loudness normalization (-norm-i)
- ✅ Short-term loudness normalization (-norm-s)
- ✅ Momentary loudness normalization (-norm-m)
- ✅ RMS maximum normalization (-norm-rm)
- ✅ RMS average normalization (-norm-ra)
📁 Export Formats
- ✅ CSV export (-csv)
- ✅ TSV export (-tsv)
- ✅ XML export (-xml)
- ✅ JSON export (-json)
🔄 Batch Processing
- ✅ Single file analysis
- ✅ Directory batch processing
- ✅ Recursive file discovery
- ✅ Multiple format support
API Reference
analyze_audio()
info, results = analyze_audio(
file_path: str,
integrated_loudness: bool = False,
short_term_loudness: bool = False,
momentary_loudness: bool = False,
loudness_range: bool = False,
true_peak: bool = False,
rms_max: bool = False,
rms_average: bool = False
)
batch_analyze_directory()
results = batch_analyze_directory(
directory_path: str,
integrated_loudness: bool = False,
short_term_loudness: bool = False,
momentary_loudness: bool = False,
loudness_range: bool = False,
true_peak: bool = False,
rms_max: bool = False,
rms_average: bool = False
)
Normalization Functions
# True peak normalization
normalize_true_peak(input_path: str, target_dbfs: float, output_path: str)
# Integrated loudness normalization
normalize_integrated_loudness(input_path: str, target_lufs: float, output_path: str)
# Short-term loudness normalization
normalize_short_term_loudness(input_path: str, target_lufs: float, output_path: str)
# Momentary loudness normalization
normalize_momentary_loudness(input_path: str, target_lufs: float, output_path: str)
Export Functions
# Export analysis results
export_to_csv(results, output_path: str)
export_to_tsv(results, output_path: str)
export_to_xml(results, output_path: str)
export_to_json(results, output_path: str)
Use Cases
Broadcasting
# Check compliance with broadcast standards
info, results = ras.analyze_audio("broadcast.wav", True, False, False, True, True, False, False)
if results.integrated_loudness < -23.0:
print("Meets EBU R128 broadcast standard")
Music Production
# Analyze dynamics and prepare for mastering
info, results = ras.analyze_audio("song.wav", True, True, True, True, True, True, True)
print(f"Dynamic Range: {results.loudness_range:.1f} LU")
Podcast Processing
# Batch normalize podcast episodes
episodes = ras.batch_analyze_directory("episodes/", True, False, False, False, True, False, False)
for file_path, (info, analysis) in episodes.items():
if analysis.integrated_loudness < -16.0:
output_path = file_path.replace(".wav", "_normalized.wav")
ras.normalize_integrated_loudness(file_path, -16.0, output_path)
Supported Formats
- WAV (all PCM variants)
- FLAC
- MP3
- AAC/M4A
- OGG/Vorbis
- And many more via Symphonia decoder
Requirements
- Python 3.10+
- Windows, macOS, or Linux
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rs_audio_stats-1.1.8-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: rs_audio_stats-1.1.8-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64b1a5e2875653e4fbea492db15afa0efda0ffad9c29847f50885d6d6e392ada
|
|
| MD5 |
63b17c1500cdf7068f2847e6ea511fa6
|
|
| BLAKE2b-256 |
8292fa05a8efa665e7948de24eebbb3acd9eda4e18b1b3342703ef9277318733
|