Skip to content

hPerezz/here-comes-the-drop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Here Comes The Drop

An intelligent audio analysis tool for detecting and analyzing drops in electronic music. Built with Python, Streamlit, and machine learning.

Overview

Here Comes The Drop is a comprehensive drop detection and analysis system for EDM and electronic music. It analyzes audio tracks to identify tension build-ups, drops, and impact events using audio signal processing and optional machine learning predictions.

Features

Audio Analysis

  • Feature Extraction: RMS energy, bass RMS, spectral centroid, spectral flux, and onset strength
  • Temporal Analysis: Sliding window statistics for tracking changes over time
  • Score Calculation:
    • Tension Score: Measures build-up and anticipation
    • Impact Score: Detects sudden energy releases
    • Stability Score: Tracks rhythmic consistency

Event Detection

  • Automatic detection of:
    • Drops: The moment when tension releases into the main beat
    • High Tension Zones: Build-up sections before drops
    • Impact Events: Sudden energy spikes

Interactive Visualization

  • Real-time audio playback with waveform display
  • Interactive timeline with zoomable, toggleable trace layers
  • Click-to-seek functionality on timeline and events
  • Color-coded event markers

Machine Learning (Optional)

  • Train custom drop detection models from your annotations
  • Real-time ML predictions with confidence scores
  • Export training data in JSON format

Annotation System

  • Manual drop marking for creating training datasets
  • Confirm or reject auto-detected drops
  • Export annotations for ML training

Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Setup

  1. Clone the repository:
git clone https://github.com/yourusername/here-comes-the-drop.git
cd here-comes-the-drop
  1. Install dependencies:
pip install -r requirements.txt

Usage

Running the Application

Start the Streamlit app:

streamlit run app.py

The app will open in your default browser at http://localhost:8501.

Analyzing Tracks

  1. Upload an audio file (WAV, MP3, FLAC, or OGG)
  2. Adjust analysis parameters in the sidebar:
    • Hop length (frame size)
    • Temporal window size
    • Score weights for tension, impact, and stability
    • Detection thresholds
  3. Click Analyze
  4. Explore the interactive timeline and detected events
  5. Click on events or the timeline to seek playback

Training ML Models

  1. Analyze multiple tracks and add manual annotations
  2. Confirm or reject auto-detected drops
  3. Run the training script:
python -m ml.train_model
  1. Enable "ML predictions" in the sidebar to use the trained model

Project Structure

here-comes-the-drop/
├── app.py                          # Main Streamlit application
├── requirements.txt                # Python dependencies
│
├── core/                           # Core analysis modules
│   ├── audio_loader.py            # Audio file loading
│   ├── feature_extractor.py       # Audio feature extraction
│   ├── temporal_features.py       # Temporal analysis
│   ├── score_calculator.py        # Tension/Impact/Stability scores
│   └── event_detector.py          # Drop/tension/impact detection
│
├── visualization/                  # Visualization components
│   ├── timeline.py                # Interactive timeline chart
│   └── audio_player.py            # Audio playback control
│
├── export/                        # Data export utilities
│   ├── data_exporter.py           # JSON export
│   └── annotation_manager.py      # Annotation management
│
├── ml/                            # Machine learning components
│   ├── dataset_builder.py         # Training dataset creation
│   ├── train_model.py             # Model training script
│   └── predictor.py               # ML inference
│
├── output/                        # Analysis results (JSON)
├── annotations/                   # Manual annotations (JSON)
├── models/                        # Trained ML models
└── samples/                       # Sample audio files

How It Works

1. Feature Extraction

The system extracts frame-based audio features using librosa:

  • RMS Energy: Overall loudness per frame
  • Bass RMS: Energy in the 20-200 Hz range
  • Spectral Centroid: Brightness of the sound
  • Spectral Flux: Rate of spectral change
  • Onset Strength: Percussive transient detection

2. Temporal Analysis

A sliding window calculates statistics over time:

  • Slope (rate of change)
  • Variance (instability)
  • Mean (average level)

3. Score Calculation

Combines features into interpretable scores (0-1):

  • Tension: High when energy is building (rising RMS, increasing flux)
  • Impact: Spikes when bass drops suddenly
  • Stability: High during consistent rhythmic sections

4. Event Detection

Uses configurable thresholds to identify:

  • Drops: High tension → high impact → high stability
  • Tension Zones: Extended periods of rising tension
  • Impact Events: Sudden energy increases

5. Machine Learning (Optional)

  • Random Forest classifier trained on annotated examples
  • Features: Audio characteristics + scores at current frame
  • Predicts: normal, pre_drop, or drop

Configuration

All analysis parameters are adjustable via the sidebar:

Analysis Parameters

  • Hop Length: Frame size for feature extraction (512-4096 samples)
  • Temporal Window: Sliding window duration (0.5-3.0 seconds)

Score Weights

Customize how features contribute to tension, impact, and stability scores.

Detection Thresholds

Adjust sensitivity for detecting tension zones, impacts, and drops.

Output Files

Analysis results are exported to JSON:

  • output/features_<trackname>.json - Frame-by-frame audio features
  • output/scores_<trackname>.json - Tension/Impact/Stability scores
  • output/events_<trackname>.json - Detected drops and events
  • annotations/<trackname>_annotations.json - Manual annotations

Requirements

librosa>=0.10.0        # Audio analysis
numpy>=1.24.0          # Numerical computing
scipy>=1.10.0          # Scientific computing
pandas>=2.0.0          # Data manipulation
plotly>=5.15.0         # Interactive visualization
streamlit>=1.37.0      # Web interface
soundfile>=0.12.0      # Audio I/O
scikit-learn>=1.3.0    # Machine learning

Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest features
  • Submit pull requests
  • Share annotated datasets

License

MIT License - feel free to use this project for any purpose.

Acknowledgments

Built with:


Analyze. Annotate. Train. Detect.

Made with passion for electronic music.

About

Drop detection and analysis system for EDM and electronic music. It analyzes audio tracks to identify tension build-ups, drops, and impact events using audio signal processing and optional machine learning predictions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages