Skip to content

RustedBytes/wav-files-normalize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wav-files-normalize

A command-line tool to normalize the loudness of WAV audio files in a directory (recursively) to a target peak level or integrated LUFS value. Supports mono 16-bit PCM WAV files at 16kHz sample rate.

Features

  • Recursive Processing: Scans input directory and subdirectories for .wav files.
  • Dual Normalization Modes:
    • LUFS: Adjusts to target integrated loudness (default: -14 LUFS) using the EBU R128 standard.
    • Peak: Adjusts to target sample peak level (default: -1 dBFS).
  • Output Mirroring: Preserves the input directory structure in the output folder.
  • Efficient: Processes files in-place with minimal memory overhead for typical audio lengths.
  • Error-Resilient: Validates file formats and handles errors gracefully with informative messages.

Installation

From Crates.io (Recommended)

cargo install wav-files-normalize

From Source

  1. Clone the repository:

    git clone https://github.com/RustedBytes/wav-files-normalize.git
    cd wav-files-normalize
  2. Build and install:

    cargo install --path .

Requires Rust 1.75+ (stable channel).

Usage

wav-files-normalize [OPTIONS] --input <INPUT> --output <OUTPUT>

Required Arguments

  • --input <INPUT>: Input directory containing WAV files (processed recursively).
  • --output <OUTPUT>: Output directory for normalized files.

Optional Arguments

  • --target-lufs <TARGET_LUFS>: Target LUFS level (default: -14.0).
  • --target-peak <TARGET_PEAK>: Target peak level in dBFS (default: -1.0).
  • --mode <MODE>: Normalization mode: lufs (default) or peak.

Run wav-files-normalize --help for full details.

Examples

Normalize to -14 LUFS (Default)

wav-files-normalize --input ./input_audio --output ./normalized_audio

This processes all .wav files in ./input_audio and subfolders, saving results to ./normalized_audio with the same structure.

Normalize to -12 LUFS

wav-files-normalize --input ./input_audio --output ./normalized_audio --target-lufs -12.0

Peak Normalization to 0 dBFS

wav-files-normalize --input ./input_audio --output ./normalized_audio --mode peak --target-peak 0.0

Testing

Run the test suite:

cargo test

Includes unit tests for scale computation (edge cases like silent files) and integration tests for file I/O.

Dependencies

  • clap: Command-line argument parsing.
  • ebur128: LUFS loudness analysis.
  • hound: WAV file reading/writing.
  • walkdir: Recursive directory traversal.
  • anyhow: Error handling.

See Cargo.toml for versions.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on the GitHub repository.

  1. Fork the project.
  2. Create a feature branch (git checkout -b feature/AmazingFeature).
  3. Commit changes (git commit -m 'Add some AmazingFeature').
  4. Push to the branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

Cite

@software{Smoliakov_Wav_Files_Toolkit,
  author = {Smoliakov, Yehor},
  month = oct,
  title = {{WAV Files Toolkit: A suite of command-line tools for common WAV audio processing tasks, including conversion from other formats, data augmentation, loudness normalization, spectrogram generation, and validation.}},
  url = {https://github.com/RustedBytes/wav-files-toolkit},
  version = {0.4.0},
  year = {2025}
}

About

Adjust audio to a target peak or integrated loudness (LUFS) of WAV files

Topics

Resources

License

Stars

Watchers

Forks

Languages