Skip to content

GronuJ/wav2416

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wav2416

A command-line tool for converting 24-bit WAV audio files to 16-bit with high-quality TPDF (Triangular Probability Density Function) dithering.

Overview

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.

Features

  • 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

Installation

From Source

Requires Rust 1.70 or later.

git clone https://github.com/GronuJ/wav2416.git
cd wav2416
cargo build --release

The compiled binary will be located at target/release/wav2416.

Using Cargo

cargo install --path .

Usage

wav2416 [OPTIONS] <directory>

Arguments

  • <directory> - Path to directory containing WAV files to convert

Options

  • -r, --recursive - Process subdirectories recursively

Examples

# 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/files

Output

The 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

Behavior

  • Only processes files with .wav extension (case-insensitive)
  • Skips files that are not 24-bit
  • By default, only processes files in the specified directory (non-recursive)
  • With -r or --recursive flag, 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

Technical Details

Dithering

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

Dependencies

  • hound - WAV file I/O
  • rand - Random number generation
  • rand_distr - Triangular distribution for TPDF

Building

# Debug build
cargo build

# Release build (optimized)
cargo build --release

# Run tests
cargo test

License

[Add your license here]

Contributing

[Add contribution guidelines here]

About

Command-line tool for converting 24-bit WAV audio files to 16-bit with TPDF dithering

Resources

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages