A command-line tool for converting 24-bit WAV audio files to 16-bit with high-quality TPDF (Triangular Probability Density Function) dithering.
wav2416 processes all 24-bit WAV files in a specified directory and converts them to 16-bit format. The tool uses TPDF dithering to minimize quantization distortion and preserve audio quality during bit-depth reduction. Original files are replaced with their converted versions.
- Converts 24-bit WAV files to 16-bit format
- High-quality TPDF dithering algorithm
- Batch processing of entire directories
- Preserves sample rate and channel configuration
- Safe file replacement with temporary file handling
- Detailed conversion statistics
Requires Rust 1.70 or later.
git clone https://github.com/GronuJ/wav2416.git
cd wav2416
cargo build --releaseThe compiled binary will be located at target/release/wav2416.
cargo install --path .wav2416 [OPTIONS] <directory><directory>- Path to directory containing WAV files to convert
-r, --recursive- Process subdirectories recursively
# Convert files in a single directory
wav2416 /path/to/audio/files
# Convert files in directory and all subdirectories
wav2416 -r /path/to/audio/files
wav2416 --recursive /path/to/audio/filesThe tool provides feedback during conversion:
Converted: /path/to/audio/file1.wav
Skipped (not 24-bit): /path/to/audio/file2.wav (16-bit)
Converted: /path/to/audio/file3.wav
Conversion complete:
Converted: 2
Skipped: 1
Errors: 0
- Only processes files with
.wavextension (case-insensitive) - Skips files that are not 24-bit
- By default, only processes files in the specified directory (non-recursive)
- With
-ror--recursiveflag, processes all subdirectories recursively - Replaces original files with converted versions
- Uses temporary files during conversion for safe operation
- Exits with error code 1 if any errors occur
The tool implements TPDF (Triangular Probability Density Function) dithering, which:
- Eliminates harmonic distortion from quantization
- Adds minimal noise floor
- Provides optimal perceptual quality for bit-depth reduction
- Uses triangular distribution centered at 0.0 with range of -1.0 to 1.0
hound- WAV file I/Orand- Random number generationrand_distr- Triangular distribution for TPDF
# Debug build
cargo build
# Release build (optimized)
cargo build --release
# Run tests
cargo test[Add your license here]
[Add contribution guidelines here]