Skip to content

mglean/mp3-matcher

 
 

Repository files navigation

Audio Volume & Encoding Normalizer

A Python application that normalizes both the volume and encoding parameters of audio files (MP3 and WAV) in a selected directory to match the loudest file.

This tool was specifically designed for digital scratch devices SC500 and SC1000 MK2, ensuring consistent audio levels across your samples and beats.

Features

  • Clean, modern GUI for easy interaction
  • Scan and analyze audio files (MP3 and WAV) in a selected directory
  • Detect loudness levels across all files
  • Normalize all files to match both the loudness and encoding parameters of the loudest file
  • Standardize sample rate, bit depth, and channels across all files
  • Overwrite original files with their normalized versions
  • Confirmation dialog before overwriting to prevent accidental data loss
  • Real-time progress display during analysis and processing
  • Automatic backup and recovery system for data safety

Requirements

  • Python 3.6 or higher
  • Required Python packages (see requirements.txt):
    • pydub
    • numpy
    • tkinter (usually comes with Python)

Installation

  1. Clone or download this repository
  2. Install the required dependencies:
pip install -r requirements.txt
  1. Make sure you have ffmpeg installed on your system (required by pydub):
    • Windows: Download from ffmpeg.org and add to PATH
    • macOS: Install with Homebrew: brew install ffmpeg
    • Linux: Install with your package manager, e.g., apt install ffmpeg

Usage

  1. Run the application:
python main.py
  1. Click "Select Directory" to choose a folder containing audio files (MP3 and WAV)
  2. Click "Analyze Files" to scan and determine loudness levels
  3. Review the analysis results in the file list
  4. Click "Normalize Files" to adjust the volume of all files to match the loudest one
  5. Confirm the operation when prompted

How It Works

The application uses the following process:

  1. Analysis Phase:

    • Loads each audio file (MP3 or WAV) using pydub
    • Calculates the RMS (Root Mean Square) loudness for each file
    • Identifies the loudest file to use as a reference
    • Extracts encoding parameters (sample rate, channels, bit depth) from the reference file
  2. Normalization Phase:

    • Creates temporary backups of all files
    • Calculates the gain needed for each file to match the reference loudness
    • Applies the gain to normalize volume
    • Converts each file to match the encoding parameters of the reference file
    • Overwrites the original files with the normalized versions
    • Provides recovery in case of errors

Project Structure

  • main.py: Entry point for the application
  • gui.py: GUI implementation using tkinter
  • audio_processor.py: Audio analysis and normalization logic
  • file_manager.py: File operations and backup management
  • utils.py: Utility functions and logging setup

Safety Features

  • Creates temporary backups before modifying any files
  • Confirms with the user before overwriting files
  • Automatically restores from backups if errors occur
  • Detailed logging for troubleshooting

License

This project is open source and available under the MIT License.

About

SC1000 Normalisation matcher

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.4%
  • Makefile 2.5%
  • Shell 1.6%
  • Batchfile 1.5%