Skip to main content

Dynamic Range Analyzer - Fight the Loudness War

Project description

DR Check - Dynamic Range Analyzer

Python 3.10+ License: GPL v3 PyPI version Tests Coverage

DR Check is a modern, fast, and accurate tool for measuring the dynamic range (DR) of audio files using the DR14 algorithm. Built from the ground up in Python, it provides professional-grade analysis with beautiful output formats.

Fight the Loudness War by analyzing and comparing the dynamic range of your music collection!

โœจ Features

  • ๐ŸŽฏ Accurate DR14 Calculation - Validated against professional tools (foobar2000 DR Meter)
  • ๐Ÿ“ Multiple Audio Formats - FLAC, WAV, MP3, M4A, OGG, AIFF, and more
  • ๐ŸŽจ Beautiful HTML Reports - Modern, responsive design with automatic album art extraction
  • ๐Ÿ“Š Multiple Output Formats - Text tables, BBCode (for forums), CSV, and HTML
  • ๐Ÿ” Batch Processing - Analyze entire albums or recursively scan music libraries
  • โšก Parallel Processing - Multi-core support for high-speed library analysis
  • ๐ŸŽต Metadata Support - Extracts artist, album, sample rate, bit depth, and format info
  • ๐Ÿ’ก Smart Error Messages - Helpful, actionable error messages with install instructions
  • ๐Ÿ–ผ๏ธ Optimized Album Art - Automatic image resizing for smaller HTML reports (with Pillow)
  • ๐Ÿงช Well Tested - Comprehensive test suite with 81+ passing tests

๐Ÿ“ธ Screenshots

Text Output

DR Check - Dynamic Range Analyzer v1.1.0
log date: 2026-01-10 10:40:05

--------------------------------------------------------------------------------
Analyzed: Willie Nelson / Red Headed Stranger
--------------------------------------------------------------------------------

DR     Peak           RMS            Duration  Track
--------------------------------------------------------------------------------
DR11   -1.28 dBFS     -16.66 dBFS    2:25      01. Time Of The Preacher
DR11   -1.60 dBFS     -17.18 dBFS    1:32      02. I Couldn't Believe It Was True
DR11   -0.16 dBFS     -16.93 dBFS    1:13      03. Time Of The Preacher Theme
DR14   -3.38 dBFS     -20.01 dBFS    1:35      04. Medley- Blue Rock Montana - Red Headed Stranger
DR11   -2.00 dBFS     -16.81 dBFS    2:21      05. Blue Eyes Crying In The Rain
DR12   -1.10 dBFS     -16.32 dBFS    3:59      06. Red Headed Stranger
DR12   -4.35 dBFS     -19.44 dBFS    0:26      07. Time Of The Preacher Theme
DR11   -1.91 dBFS     -19.03 dBFS    1:48      08. Just As I Am
DR12   -2.55 dBFS     -18.47 dBFS    0:53      09. Denver
DR12   -6.14 dBFS     -21.08 dBFS    0:47      10. O'er The Waves
DR11   -3.83 dBFS     -17.57 dBFS    1:56      11. Down Yonder
DR12   -2.12 dBFS     -18.11 dBFS    5:23      12. Can I Sleep In Your Arms
DR11   -1.60 dBFS     -15.38 dBFS    2:52      13. Remember Me (When The Candle Lights Are Gleaming)
DR12   -0.65 dBFS     -15.98 dBFS    4:22      14. Hands On The Wheel
DR11   -3.52 dBFS     -18.10 dBFS    2:15      15. Bandera
--------------------------------------------------------------------------------

Number of tracks:  15
Official DR value: DR12

Samplerate:        96000 Hz
Channels:          2
Bits per sample:   24
Bitrate:           4608 kbps
Codec:             FLAC
================================================================================

HTML Output

DR Check - HTML Screenshot

Beautiful, modern reports with:

  • Album artwork (automatically extracted)
  • Color-coded DR values (green/orange/red)
  • Responsive design for desktop and mobile
  • Optimized images for faster loading
  • Professional styling

๐Ÿš€ Quick Start

Installation

PyPi

# pip
pip install drcheck

# pipx
pipx install drcheck

Local git checkout w/ uv

# Clone the repository
git clone https://github.com/nixternal/drcheck.git
cd drcheck

# Install with uv (recommended)
uv pip install -e .

# Or with pip
pip install -e .

Basic Usage

# Analyze a single file
drcheck analyze song.flac

# Analyze an entire album
drcheck analyze /path/to/album/

# Recursive scan of music library
drcheck analyze -r /path/to/music/library/

# Save results to file
drcheck analyze album/ --save

# Generate HTML report
drcheck analyze album/ --save --format html

๐Ÿ“– Usage Guide

Commands

analyze

Analyze audio files and calculate DR14 values.

drcheck analyze [OPTIONS] PATHS...

Options:

  • -r, --recursive - Recursively scan subdirectories
  • --show-channels - Show per-channel DR values for stereo files
  • --save - Save results to file
  • -o, --output DIR - Output directory (default: source directory)
  • --format FORMAT - Output format: text, bbcode, csv, html (default: text)
  • --filename NAME - Output filename (default: dr.txt, auto-adjusts extension)
  • -j, --workers N - Number of parallel workers (auto-selects based on job size)

Examples:

# Single file analysis
drcheck analyze mysong.flac

# Album analysis with text output
drcheck analyze album_folder/

# Save as HTML report
drcheck analyze album/ --save --format html

# Recursive scan, save as CSV
drcheck analyze -r music_library/ --save --format csv -o ~/reports/

# Show per-channel DR values
drcheck analyze stereo_file.flac --show-channels

# Multiple paths
drcheck analyze album1/ album2/ single.flac

# Parallel processing with 4 workers
drcheck analyze -r music_library/ -j 4

scan

Preview files that would be analyzed without processing them.

drcheck scan [OPTIONS] PATH

Options:

  • -r, --recursive - Recursively scan subdirectories

Example:

drcheck scan -r /music/library/

version

Show detailed version information including Python version, platform, and supported formats.

formats

List all supported audio formats.

drcheck formats

Output Formats

Text (default)

Clean ASCII tables suitable for terminals and text files.

drcheck analyze album/ --save --format text

HTML

Beautiful, modern reports with album art and color-coded DR values.

drcheck analyze album/ --save --format html

Features:

  • Automatic album art extraction (from files or folder images)
  • Responsive design (mobile-friendly)
  • Color-coded DR values
  • Complete technical information
  • Self-contained (single HTML file)

[!TIP] Optimized HTML Reports Install Pillow to automatically resize and compress album art. This can significantly reduce the size of your HTML reports (often by 80-90%) when using high-resolution cover art.

# Install Pillow
uv pip install pillow
# or
pip install pillow

Example of size reduction:

Before (without Pillow):
  Album art: 2.4 MB โ†’ HTML report: 3.2 MB

After (with Pillow):
  Album art: 2.4 MB โ†’ 85 KB โ†’ HTML report: 320 KB

Savings: 90% smaller files!

BBCode

Formatted for posting on audio forums.

drcheck analyze album/ --save --format bbcode

CSV

Spreadsheet-compatible format for data analysis.

drcheck analyze album/ --save --format csv

Or pipe directly:

drcheck analyze album/ --format csv > results.csv

๐ŸŽต Supported Audio Formats

Lossless (via libsndfile):

  • FLAC (.flac)
  • WAV (.wav)
  • AIFF (.aiff, .aif, .aifc)
  • OGG Vorbis (.ogg, .oga)
  • Opus (.opus)

Lossy (requires pydub + ffmpeg):

  • MP3 (.mp3)
  • M4A/AAC (.m4a, .mp4, .aac)
  • WMA (.wma)

To enable MP3/M4A support:

# Install pydub
uv pip install pydub

# Install ffmpeg (system package)
# Ubuntu/Debian:
sudo apt install ffmpeg

# macOS:
brew install ffmpeg

# Arch Linux:
sudo pacman -S ffmpeg

๐Ÿ”ฌ Understanding DR Values

The DR (Dynamic Range) scale measures the difference between the loudest and average loudness of an audio track:

DR Value Quality Description
DR14+ ๐ŸŸข Excellent Wide dynamic range, natural sound
DR8-13 ๐ŸŸก Good Moderate compression, still enjoyable
DR0-7 ๐Ÿ”ด Poor Heavily compressed, "loudness war" victim

Note: Higher DR doesn't always mean "better" - it depends on the genre and artistic intent. Classical and jazz typically have DR14+, while modern pop/rock often ranges from DR6-10.

๐Ÿ“Š Error Handling (v1.1.1)

Smart Error Messages (v1.1.1): When errors occur, DR Check now provides helpful, actionable guidance:

  • Missing MP3/M4A support? Shows exact install command
  • Corrupted files? Suggests how to fix them
  • Audio too short? Explains the 6-second minimum requirement

Examples of intelligent error messages with helpful suggestions:

================================================================================
โš ๏ธ  Failed to process 3 of 50 file(s)
================================================================================

๐Ÿ“‹ Missing Lossy Format Support (2 file(s)):
   โ€ข song1.mp3
     โ†’ Install: pip install drcheck[lossy]
     โ†’ Also ensure ffmpeg is installed on your system

๐Ÿ“‹ Audio Too Short (1 file(s)):
   โ€ข intro.wav (need at least 6 seconds for DR analysis)

๐Ÿ’ก Tips:
   โ€ข For MP3/M4A support, install: pip install drcheck[lossy]
   โ€ข DR analysis requires at least 6 seconds of audio
     (two 3-second blocks for measurement)

๐Ÿงช Development

Running Tests

# Install dev dependencies
uv pip install pytest pytest-cov

# Run all tests
pytest tests/ -v

# Run with coverage report
pytest tests/ --cov=drcheck --cov-report=html

# Run specific test file
pytest tests/test_analysis.py -v

Project Structure

drcheck/
โ”œโ”€โ”€ drcheck/              # Main package
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ analysis.py       # Core DR14 calculation
โ”‚   โ”œโ”€โ”€ audio.py          # Audio file reading
โ”‚   โ”œโ”€โ”€ cli.py            # Command-line interface
โ”‚   โ”œโ”€โ”€ formatters.py     # Output formatting
โ”‚   โ””โ”€โ”€ parallel.py       # Parallel processing
โ”œโ”€โ”€ tests/                # Test suite
โ”‚   โ”œโ”€โ”€ test_analysis.py
โ”‚   โ”œโ”€โ”€ test_audio.py
โ”‚   โ”œโ”€โ”€ test_formatters.py
โ”‚   โ””โ”€โ”€ test_parallel.py
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ pyproject.toml

Code Quality

  • โœ… Full type hints (pyright compliant)
  • โœ… Modern Python 3.10+ features
  • โœ… Comprehensive test coverage (81+ tests)
  • โœ… Clean, documented code
  • โœ… Follows Python best practices

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Guidelines

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass (pytest tests/)
  6. Commit your changes (git commit -m 'Add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

๐Ÿ“ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ”— Related Resources

๐Ÿ“ง Contact


Made with โค๏ธ for music lovers who care about sound quality

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drcheck-1.1.1.tar.gz (98.4 kB view details)

Uploaded Source

Built Distribution

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

drcheck-1.1.1-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file drcheck-1.1.1.tar.gz.

File metadata

  • Download URL: drcheck-1.1.1.tar.gz
  • Upload date:
  • Size: 98.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for drcheck-1.1.1.tar.gz
Algorithm Hash digest
SHA256 162a68d6c69dd2e01fba350624b8a7d8388e7955fcf8327d3cdd62f2adc3510e
MD5 faceadc752dc4308d040595f83fabb49
BLAKE2b-256 be761f64322a731c1267c127f38f7567215685e72f9424fe611f6dc4a0ef674f

See more details on using hashes here.

File details

Details for the file drcheck-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: drcheck-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 40.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for drcheck-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 09fddcf100bcb2a576773dadfa47389d6638d3c8d2030ec34ef9670d1d739753
MD5 bdfcee21aa76c22e33077bc46a03cca3
BLAKE2b-256 a6f184a087b0ec9ae15df22a36fd6a6df9ea85ac4eb6fc82b4e2cc8fc543df6f

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