Skip to content

kittrellbj/audiomaster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Supporters

If this was useful and you feel like helping me out, I make music, too. Here’s my YouTube: https://www.youtube.com/@lnbk

Batch WAV “Mastering” Processor (Python + FFmpeg)

This project is a batch audio processor for .wav files. It uses FFmpeg audio filters to apply a consistent “shipping-ready” treatment across many files with one command.

It reads WAV files from ./input/ and writes processed WAV files to ./output/ using the same filenames (overwriting existing files).


What it does (per file)

Processing pipeline:

  1. Reads file duration using ffprobe
  2. Trims the start and end (trimHeadSec, trimTailSec) to remove common edge pops/clicks
  3. Applies optional tone shaping (small mastering-style EQ):
    • High-pass (remove sub-bass rumble)
    • Low-shelf (usually a small cut to reduce mud/boxiness)
    • Harshness cut (reduces bite/forwardness)
    • Optional low-pass (only if overly fizzy)
  4. Applies optional light compression (“glue”)
  5. Applies optional fade-in/out after trimming (avoids abrupt edges and can help mask minor edge artifacts)
  6. Applies optional two-pass loudness normalization using loudnorm (EBU R128-style):
    • Pass 1 measures loudness/true peak and prints JSON
    • Pass 2 applies consistent normalization using the measured values
  7. Optionally resamples to a target sample rate and applies triangular dither (most useful when delivering 16-bit)

Output is WAV PCM (16-bit or 24-bit) into ./output/.


What it does NOT do

This is not a full DAW or restoration suite. It does not:

  • Split stems (no vocal/instrumental separation)
  • Pitch correction / autotune / time stretching
  • De-clip, de-reverb, spectral repair, or advanced restoration
  • Produce MP3/AAC/FLAC (outputs WAV only)
  • Automatically “fix” a bad mix (it applies gentle, global processing)

If your input audio is heavily clipped, very noisy, or has strong bleed, you may need dedicated tools before/after this script. This script is designed so you can get an entire album ready to ship, fade ins/outs will be uniform across the tracks, loudness and normalization (should be) uniform, and so forth to make an album feel more cohesive/unified. It (can) perform a little light cleaning/mastering on the whole album at once, if you so desire.

There is no warranty, actual or implied, in the use of this software. The software does not overwrite your original files (it makes new copies after processing), but even so, always keep backup copies of everything (just in case).


Folder layout

Put the script in a folder structure like:

AudioProcessing/
  master.py
  input/
    song1.wav
    song2.wav
  output/
    (generated)
  • Drop WAV files you want to process into input/
  • Run the script
  • Processed WAV files appear in output/

Requirements

  • Python 3.10+ recommended
  • FFmpeg installed and on PATH in environment variables:
    • ffmpeg
    • ffprobe

Verify:

ffmpeg -version
ffprobe -version

Setup (Windows example)

If you installed FFmpeg to C:\ffmpeg\bin\, make sure that folder is in your PATH. (If you don't know how to do this, there are many guides on the Internet and YouTube University.)

Verify:

where ffmpeg
where ffprobe

Run

From the folder that contains master.py:

python master.py

The script will create input/ and output/ if they do not exist.


Configuration

All settings live at the top of master.py under Configuration (globals).

Common changes:

  • Edge trimming: trimHeadSec, trimTailSec - the amount of time to cut at the beginning and/or end of the song, to remove artifacts and popping that sometimes occurs at the head or tail of a track.
  • Fades: fadeDurationSec - fades in/out the song at the head and tail (given in seconds).
    • short “anti-abrupt” fades: ~0.15–0.50 sec
    • musical intro/outro fades: ~2–10 sec (recommended: 3-5 seconds is pretty smooth for songs)
  • Loudness targets: targetI, targetTP, targetLRA
  • Delivery: outputSampleRate, outputBitDepth - defaults given should be acceptable to most distributors to my knowledge.
  • Enable/disable features: enable* toggles (0/1) - 0 for disabled, 1 for enabled. You can switch on/off any features as you desire.

Notes / gotchas

  • If trimming removes too much and the remaining audio is extremely short, the file is skipped.
  • Denoise is off by default because aggressive denoise can sound “watery” or metallic.
  • Large fade times are fine if that’s what you want, but they are not “minimal.”

License

MIT License

Copyright (c) 2025 Brian Kittrell

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Outro

If this was useful and you feel like helping me out, I make music, too. Here’s my YouTube: https://www.youtube.com/@lnbk

About

Automation to batch process or "master" WAV audio files, add a little polish, etc.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages