Skip to main content

Professional-grade audio analysis tool with EBU R128 loudness measurement

Project description

rs_audio_stats Python Library

Professional-grade audio analysis tool with bs1770gain-compliant EBU R128 loudness measurement for Python.

Contents

  • rs_audio_stats/ - Python package source code
  • pyproject.toml - Maturin build configuration
  • test_rs_audio_stats.py - API test suite
  • API_REFERENCE.md - Complete API documentation

Installation

From Source (Requires Rust)

# Install maturin
pip install maturin

# Build and install in development mode
maturin develop --features python

# Build wheel for distribution
maturin build --release --features python

From Wheel (Windows)

pip install rs_audio_stats-1.1.0-cp39-abi3-win_amd64.whl

Quick Start

import rs_audio_stats as ras

# Analyze audio file
info, results = ras.analyze_audio_all("audio.wav")
print(f"Integrated Loudness: {results.integrated_loudness} LUFS")

# Normalize audio
ras.normalize_to_lufs("input.wav", -23.0, "output.wav")

Features

  • ✅ Complete Python API matching the EXE functionality
  • ✅ All analysis measurements (integrated loudness, peak, RMS, etc.)
  • ✅ Audio normalization to target levels
  • ✅ Batch processing capabilities
  • ✅ Export to CSV/JSON formats
  • ✅ Comprehensive error handling
  • ✅ Type hints and documentation
  • ✅ Cross-platform compatibility

Supported Audio Formats

Input

  • WAV (PCM, 16/24/32-bit)
  • FLAC, MP3, AAC, OGG, ALAC, MP4/M4A

Output

  • WAV (32-bit float PCM)

API Overview

Core Functions

  • analyze_audio() - Analyze with specific measurements
  • analyze_audio_all() - Analyze with all measurements
  • get_audio_info() - Get file information only
  • batch_analyze() - Process multiple files

Normalization

  • normalize_true_peak() - Normalize to peak level
  • normalize_integrated_loudness() - Normalize to LUFS level
  • normalize_rms_max() - Normalize to RMS max level
  • normalize_rms_average() - Normalize to RMS average level

Export

  • export_to_csv() - Export results to CSV
  • export_to_json() - Export results to JSON

Utilities

  • find_audio_files() - Find audio files in directory
  • Convenience wrapper functions with simplified APIs

Testing

# Run API structure tests
python test_rs_audio_stats.py

# Expected output when bindings are not built:
# Warning: Python bindings are not available.
# This is expected in a cross-compilation environment.

Building for Windows

This package includes cross-compilation support for Windows from Linux:

# Add Windows target
rustup target add x86_64-pc-windows-gnu

# Build for Windows
maturin build --release --target x86_64-pc-windows-gnu --features python

Performance

  • WAV files: Ultra-fast analysis path
  • Other formats: Robust analysis with full decoding
  • SIMD optimizations enabled by default
  • Memory-efficient streaming processing

License

MIT License - See LICENSE file for details.

Documentation

See API_REFERENCE.md for complete API documentation with examples.

Project details


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

If you're not sure about the file name format, learn more about wheel file names.

rs_audio_stats-1.1.0-cp310-abi3-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.10+Windows x86-64

File details

Details for the file rs_audio_stats-1.1.0-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for rs_audio_stats-1.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 de9ad718a89ae4fd91752b93fb48981658ee56d35143f2639598957a5748b312
MD5 4b081d6e5037a991db31adb7d66ebbb8
BLAKE2b-256 a2aecbc0d8e056a79b2990ce9a8ab6f0dafde7d543a989eabc38a6fdfe59882c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page