🎵 Complexity Audio Classifier

Interactive Tutorial: Understanding Machine Sound Analysis through Information Theory

← Back to Binary Split Game

🎯 Project Overview

The Complexity Audio Classifier is a sophisticated machine sound analysis system that uses novel complexity metrics derived from information theory to detect multi-level machine degradation. Unlike traditional audio classification methods that rely on domain-specific features, this system analyzes the fundamental structural and algorithmic properties of sound.

📂 Source Code Repository

The complete source code for this project is available on GitHub:

🔗 GitHub Repository

Healthy

Strong harmonics, minimal noise, stable frequency

Early Warning

Slight instability, minor artifacts, subtle resonances

Moderate Issue

Noticeable wobble, regular artifacts, multiple resonances

Severe Issue

Highly unstable, frequent artifacts, bursts of noise

🏗️ System Architecture

Audio Input
Preprocessing
Complexity Features
Classification
Output Label

🔑 Key Features

Binary Split Game (BSG)

Measures structural complexity through recursive pattern analysis

Recursive Bilateral Symmetry (RBS)

Detects hierarchical palindromic structures in signals

Hybrid Pipeline

Fast first-pass filtering with detailed multi-level classification

Information Theory Foundation

Based on Kolmogorov complexity and Shannon entropy principles

Performance: The system achieves ~87.5% accuracy across four degradation levels with processing times of ~0.0017s for BSG and ~0.0502s for RBS per sample.

📚 Theoretical Foundation

The Complexity Audio Classifier is grounded in fundamental principles of information theory and algorithmic complexity. Understanding these concepts is crucial to appreciating how the system works.

🧮 Kolmogorov Complexity

The theoretical ideal for measuring complexity is Kolmogorov Complexity - the length of the shortest computer program that can generate a given string. However, this is uncomputable, so we use practical approximations.

Complexity Examples:

  • Simple Signal: Pure sine wave - highly predictable, low complexity
  • Random Signal: White noise - unpredictable, medium complexity
  • Complex Signal: Speech/Music - structured but varied, high meaningful complexity

📊 Shannon Entropy

Shannon entropy quantifies the uncertainty in a signal. For a probability distribution P, entropy is calculated as:

H(P) = -Σ p(i) * log₂(p(i))

Spectral Entropy Application:

  1. Compute power spectrum via FFT
  2. Normalize to create probability distribution
  3. Apply Shannon entropy formula
  4. Normalize by maximum possible entropy

🎵 Audio Processing Pipeline

  1. Audio Loading: Convert to 22050 Hz, mono, normalized
  2. Spectrogram Computation: Short-time Fourier Transform (STFT)
  3. Binarization: Convert to binary representation using adaptive thresholding
  4. Feature Extraction: Apply BSG and RBS algorithms
  5. Classification: Random Forest classifier on extracted features
Key Insight: The system analyzes the "rules" that generate sounds rather than the sounds themselves, making it more generalizable across different types of audio.

🎮 Binary Split Game (BSG) Algorithm

The Binary Split Game is a recursive algorithm that analyzes binary strings by splitting them in half and comparing corresponding positions. It provides a computable approximation of algorithmic complexity.

🔄 How BSG Works

Try the BSG Algorithm:

Click "Run BSG Algorithm" to see the step-by-step process...

📏 BSG Metrics

Structural Complexity (SC)

Sum of lengths of all strings in the reduction path

Depth

Number of reduction steps before termination

Max Width

Length of the initial binary string

Final State

Terminating state: '0', '1', or 'Null'

🎯 BSG in Audio Analysis

Research findings show that BSG assigns higher structural complexity to ordered signals with clear spectral patterns than to chaotic signals. This counterintuitive result makes BSG particularly effective for distinguishing healthy (ordered) machine sounds from failing (chaotic) ones.

Key Finding: Healthy machines produce more structured patterns that require more complex descriptions under BSG analysis, while failing machines produce simpler (more random) patterns.

🔄 Recursive Bilateral Symmetry (RBS) Algorithm

RBS detects hierarchical palindromic structures in strings, representing a nested arrangement of symmetrical patterns. It's particularly effective at identifying self-similar structures in audio signals.

🧩 Understanding RBS

RBS Example: "011110111110"

0 1 1 1 1 0 1 1 1 1 1 0

Structure Analysis:

  • Core "101" at positions 5-7: RBS Order 0
  • Framed by "11": "11(101)11" → "1110111": RBS Order 1
  • Framed by "01" and "10": "01(1110111)10" → Full string: RBS Order 2

🔍 RBS Algorithm Demo

Click "Analyze RBS Structure" to see the analysis...

📊 RBS Patterns in Machine Sounds

Healthy Machines

Higher RBS order (~15.5)

More symmetrical patterns

Early Warning

Moderate RBS order (~10.1)

Some symmetry loss

Moderate Issue

Lower RBS order (~5.5)

Significant asymmetry

Severe Issue

Lowest RBS order (~3.6)

Minimal symmetry

Computational Note: RBS analysis is computationally expensive (~0.0502s per sample) compared to BSG (~0.0017s), but provides valuable complementary information about symmetrical structures.

🔄 Hybrid Classification Pipeline

The system uses a two-stage hybrid approach that combines fast filtering with detailed analysis for optimal performance and accuracy.

⚡ Stage 1: Adaptive Complexity Filter

Fast First-Pass Filtering

  1. Quick Metrics: Calculate BSG complexity, RBS order, transition counts
  2. Threshold Comparison: Compare against calibrated thresholds
  3. Binary Classification: Healthy vs. Potentially Failing
  4. Decision: Proceed to detailed analysis if needed

🔬 Stage 2: Enhanced Hybrid Classifier

Detailed Multi-Level Analysis

Feature Extraction

  • BSG Complexity
  • RBS Orders (max, avg)
  • Hamming Weight
  • Transition Counts
  • Normalized Metrics

Classification

  • Random Forest Classifier
  • 100 decision trees
  • Four-class output
  • Feature importance ranking

📈 Performance Metrics

System Performance

Accuracy

87.5%

Across four degradation levels

BSG Speed

0.0017s

Per sample calculation

RBS Speed

0.0502s

Per sample calculation

Total Processing

0.0711s

Complete feature extraction

Efficiency Gain: The hybrid approach processes most files with quick assessment only, triggering detailed analysis only when necessary, resulting in significant computational savings.

🚀 Interactive Demo

Try the algorithms with your own data and see how they work in real-time!

🎮 Complexity Comparison Tool

Click "Compare Complexity" to see the analysis...

🔧 Feature Simulator

Simulate Machine Degradation:

0.1
0.2
Adjust parameters and click "Simulate Machine Condition"...

📊 Pattern Visualizer

Binary Pattern Analysis

Note: This demo provides simplified implementations for educational purposes. The full system processes audio spectrograms with much more sophisticated analysis.