Skip to content

Anshul3901/crossfade_ML

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

CrossFade ML

Project Description

CrossFade ML is a Python-based tool for intelligent audio crossfading. It leverages machine learning to predict optimal fade durations between two songs based on their BPM (beats per minute), and applies a smooth crossfade. The project is designed for DJs, audio engineers, and music enthusiasts who want to automate and optimize the process of transitioning between tracks.

Features

  • Automatic BPM Detection: Uses signal processing to estimate the BPM of audio tracks.
  • Machine Learning Model: Trains a Gradient Boosting Regressor to predict ideal fade durations based on BPM.
  • Energy Analysis: Calculates and compares the energy of the output and control tracks.
  • Batch Processing: Can process a folder of audio files for model training.
  • Crossfade Application: Applies a smooth crossfade between two selected tracks.

Project Structure

  • project.py: Main script containing all logic for BPM detection, model training, crossfading, and energy analysis.
  • crossfades/: Directory for storing generated crossfaded audio files.
  • edm_hse_id_001-004_wav/: Example folder containing training audio files (WAV format).
  • Output.wav, Control.wav: Example output and control audio files.
  • Output.txt, Control.txt: Text files containing energy values for output and control tracks.

Requirements

  • Python 3.7+
  • All Python dependencies are listed in requirements.txt.

Install dependencies with:

It is recommended to use a virtual environment:

python3 -m venv .venv
source .venv/bin/activate  # On Windows use: .venv\Scripts\activate
pip install -r requirements.txt

Usage

  1. Prepare your audio files:

    • Place your training WAV files in a folder (e.g., edm_hse_id_001-004_wav/).
    • Place the two songs you want to crossfade (e.g., paathshala.wav, sunshine.wav) in the project root.
    • Place a control track as Control.wav if you want to compare energy.
  2. Run the script:

    python project.py

    This will:

    • Train the model on the training folder.
    • Predict fade durations for the two selected songs.
    • Apply the crossfade and save the result as Output.wav.
    • Calculate and save energy values for both the output and control tracks.
  3. Check Results:

    • Listen to Output.wav for the crossfaded result.
    • Review Output.txt and Control.txt for energy analysis.

Customization

  • To use different songs, change the song1_path and song2_path variables in project.py.
  • To use a different training folder, change the folder_path variable.

License

This project is for educational and research purposes. Please ensure you have the rights to use any audio files you process.


Created as part of a project for Techin 513.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%