Rhythm Pattern Explorer
A comprehensive web application for mathematical analysis, generation, and transformation of rhythmic patterns using advanced music theory algorithms and geometric visualizations.
🚀 Launch the Application
📐 Interactive Documentation with Mathematical Equations
Table of Contents
- Overview
- Getting Started
- Core Features
- Pattern Input System
- Analysis Engine
- Pattern Generators
- Pattern Transformers
- Database & Management
- Interactive Sequencer
- Theoretical Background
- Creative Misuse & Experimental Applications
- Technical Architecture
- References
Overview
The Rhythm Pattern Explorer is a sophisticated tool that bridges the gap between mathematical music theory and practical rhythm creation. It implements cutting-edge algorithms from researchers like Andrew Milne, Godfried Toussaint, and Clarence Barlow to provide musicians, composers, researchers, and curious minds with powerful tools for understanding and creating rhythmic patterns.
Key Capabilities
- Universal Pattern Input: Parse 20+ different rhythm notation formats
- Mathematical Analysis: Perfect balance, syncopation, geometric center of gravity
- Pattern Generation: Euclidean rhythms, funk generators, stochastic mutation
- Intelligent Transformation: Barlow indispensability, Wolrab mode (reversed logic)
- Interactive Visualization: Real-time circular sequencer with geometric analysis
- Comprehensive Database: Store, search, and categorize rhythm patterns
- Theoretical Grounding: Based on peer-reviewed music mathematics research
Getting Started
Quick Start
- Open the Application: Load
app/index.html
in a modern web browser
- Parse Your First Pattern: Enter
E(3,8)
in the Universal Pattern Input
- Explore Analysis: View the mathematical breakdown and circular visualization
- Try Transformations: Use the Barlow Transformer to dilute/concentrate onsets
- Generate Variations: Create mutated patterns with the Rhythm Mutator
- Save to Database: Add interesting patterns for later exploration
Basic Workflow
Input Pattern → Analyze → Transform/Generate → Visualize → Save → Explore
Core Features
The app supports an extensive range of rhythm notation formats:
Geometric Patterns
- Regular Polygons:
P(3,1)
- 3-sided polygon with offset 1
- Combined Polygons:
P(3,1)+P(5,0)
- Automatic LCM expansion
- Polygon Subtraction:
P(3,0)+P(5,1)-P(2,0)
- Perfect balance via subtraction
- Shorthand:
tri
, pent
, hept
, oct
- triangle, pentagon, heptagon, octagon
Euclidean Rhythms
- Basic:
E(3,8)
- 3 onsets distributed across 8 steps
- With Offset:
E(3,8,2)
- Start from step 2
- Traditional Names:
tresillo
= E(3,8)
- Complements:
comp E(3,8)
- Euclidean complement
Binary Representations
- Binary:
b101010
or 101010
- Hexadecimal:
0x92:8
(with step count)
- Octal:
0o111
- Decimal:
73
or d73
(prefix disambiguates from binary)
Musical Patterns
- Onset Arrays:
[0,3,6]:8
- Specific onset positions
- Morse Code:
M:SOS
or -.--
- Rhythmic morse patterns
- Random:
R(3,8)
- 3 random onsets in 8 steps
- Bell Curve Random:
R(r,8)
- Bell curve distribution, avoids extremes (rarely 0 or 8 onsets)
Advanced Operations
- Transformations:
~pattern
(invert), rev pattern
(retrograde)
- Stretch/Squeeze:
S:2 pattern
, Q:0.5 pattern
- Quantization:
pattern;12
(clockwise), pattern;-6
(counterclockwise)
- Pattern Rotation:
pattern@3
- Rotate by 3 steps
- Pattern Stringing:
pattern1 pattern2 pattern3
(space-separated concatenation)
- Named Patterns:
tresillo=E(3,8)
, mypattern=P(3,1)+P(5,0)
- Custom Durations:
D:1,5 pattern
(short=1, long=5)
- Progressive Barlow:
patternB>target
- Steps through Barlow transformations to target onset count
- Progressive Wolrab:
patternW>target
- Anti-Barlow transformations (reversed indispensability logic)
- Progressive Euclidean:
patternE>target
- Steps through Euclidean transformations
- Progressive Dilcue:
patternD>target
- Anti-Euclidean transformations
Examples:
E(1,8)B>8
- Start with 1 onset, use Barlow to progressively build to 8 onsets (full pattern)
E(5,16)W>3
- Start with 5 onsets, use Wolrab to progressively reduce to 3 onsets
P(3,1)E>12
- Start with triangle pattern, use Euclidean to progressively build to 12 onsets
0x92D>1
- Start with tresillo (hex), use Dilcue to progressively reduce to 1 onset
Usage: Parse the pattern (e.g., E(1,8)B>8
) to start progressive mode, then press Enter repeatedly to step through transformations. The UPI content stays unchanged, only the analysis and sequencer update with each step.
Pattern Combinations vs Stringing
- Combinations:
P(3,1)+P(5,0)
- Mathematical LCM combination using logical OR
- Stringing:
P(3,1) P(5,0)
- Sequential concatenation, patterns play one after another
- Combinations create polyrhythms, Stringing creates sequences
2. Mathematical Analysis Engine
Perfect Balance Analysis (Milne’s Theory)
Based on Andrew Milne’s groundbreaking work on rhythmic balance:
- Balance Magnitude: Measures how “centered” a rhythm is geometrically
- Perfect Balance: When the sum of onset vectors equals zero (∑e^(i2πkⱼ/n) = 0)
- Mathematical Rendering: Equations displayed with MathJax for proper mathematical notation
- Balance Rating: Perfect, Excellent, Good, Fair, Poor
- Geometric Center: Visual representation of rhythmic “weight”
- Interactive Equations: Click the 🧮 button next to analysis sections to view mathematical formulas
Syncopation Analysis (Barlow’s Indispensability)
Implements Clarence Barlow’s indispensability theory:
- Metrical Hierarchy: Ranks each position’s rhythmic importance
- Syncopation Level: Measures how much a pattern conflicts with metric expectations
- Prime Factorization: Uses mathematical decomposition of meter
- Stratified Analysis: Multi-level metric evaluation
- Pickup Beat Recognition: Special handling for anacrustic positions
Geometric Properties
- Center of Gravity: Mathematical centroid of onset distribution
- Magnitude Analysis: Vector sum calculations
- Symmetry Detection: Rotational and reflective symmetries
- Complexity Metrics: Pattern regularity and predictability measures
3. Pattern Generators
Euclidean Generator
Based on Godfried Toussaint’s research on Euclidean rhythms:
- Algorithm: Distributes onsets as evenly as possible
- Musical Applications: Found in traditional music worldwide
- Mathematical Basis: Euclidean algorithm for greatest common divisor
- Cultural Examples: Cuban tresillo, African bell patterns, Turkish aksak
Funky Rhythm Generator
Creates groove-based patterns using musical intelligence:
- Groove Templates: Funk, Latin, Afro, House styles
- Probabilistic Generation: Beat-strength based onset placement
- Polyrhythmic Layers: Multiple intersecting rhythmic cycles
- Funky Euclidean: Euclidean rhythms with groove deviations
Stochastic Mutator
Transforms existing patterns while preserving character:
- Mutation Styles: Balanced, Syncopate, Straighten, Groove, Swing, Shuffle
- Displacement Logic: Intelligent onset shifting
- Character Preservation: Maintains rhythmic “feel”
- Progressive Generation: Multiple variations in sequence
Implements Clarence Barlow’s indispensability-based transformations:
Dilution (Onset Removal):
- Removes least indispensable onsets first
- Preserves rhythmic coherence
- Maintains strong metric positions
Concentration (Onset Addition):
- Adds onsets to most indispensable positions
- Strengthens metric structure
- Creates denser, more active patterns
Progressive Transformations:
- Step-by-step sequences from current to target density
- Visualizes transformation process
- Allows selection of intermediate steps
- Enter key triggers Progressive mode from Target Onsets input
Wolrab Mode (🙃 Experimental)
Revolutionary “anti-Barlow” transformation that inverts indispensability logic:
Reverse Dilution:
- Removes MOST indispensable onsets first
- Destroys metric hierarchy
- Creates anti-metrical, syncopated patterns
Reverse Concentration:
- Adds LEAST indispensable positions
- Emphasizes off-beats
- Generates surprising rhythmic results
Musical Applications:
- Creates unconventional grooves
- Challenges rhythmic expectations
- Useful for avant-garde compositions
- Generates “wrong” rhythms that feel right
Progressive Offsets
Universal pattern rotation transformer that works with any rhythm pattern:
Progressive Forward Stepping:
- Press Enter in Forward Step box for cumulative offsets: +1, +2, +3…
- Customizable increment (e.g., set to 2 for +2, +4, +6…)
- Systematic exploration of pattern rotations
Progressive Backward Stepping:
- Press Enter in Backward Step box for negative offsets: -1, -2, -3…
- Independent increment control for backward direction
- Reverse pattern exploration
Key Features:
- Universal Compatibility: Works with Euclidean, polygons, custom patterns
- Real-time Preview: Immediate audio and visual feedback
- Offset Tracking: Current offset display from original pattern
- Reset Function: Return to original pattern anytime
- Manual Mode: One-time offset using step value differences
Musical Applications:
- Groove displacement and timing variations
- Rhythmic phrase development
- Pattern evolution through systematic rotation
- Polyrhythmic exploration with offset patterns
Usage Examples:
E(3,8) → Forward Step +1 → E(3,8) rotated by 1, 2, 3... steps
P(5,2) → Backward Step -2 → Pentagon pattern offset by -2, -4, -6...
Custom pattern → Mixed forward/backward → Complex offset sequences
Progressive Pattern Lengthening
Universal pattern extension transformer that appends random steps using intelligent bell curve distribution:
Progressive Extension:
- Press Enter in Steps to Add box for cumulative extensions: +4, +8, +12… steps
- Customizable step increment (e.g., set to 6 for +6, +12, +18…)
- Bell curve onset distribution - avoids empty or full extension sections
Smart Random Extensions:
- Uses same bell curve logic as R(r,n) patterns
- Automatically determines musically appropriate onset densities
- Rarely generates empty extensions (0 onsets) or completely filled extensions
- Favors moderate onset densities for musical interest
Key Features:
- Universal Compatibility: Works with Euclidean, polygons, custom patterns, any rhythm
- Real-time Preview: Immediate audio and visual feedback for extensions
- Extension Tracking: Current extension count and total length display
- Reset Function: Return to original pattern length anytime
- Manual Mode: One-time extension using current step value
Musical Applications:
- Phrase development and extension
- Compositional pattern expansion
- Live performance with progressive pattern building
- Algorithmic composition with intelligent randomness
Usage Examples:
E(3,8) → Steps to Add: 4 → E(3,8) + 4 random steps, then +4 more, etc.
P(5,2) → Steps to Add: 6 → Pentagon + 6 steps (2-4 onsets likely), progressive building
Custom pattern → Steps to Add: 3 → Minimal extensions for subtle pattern growth
5. Interactive Sequencer
Real-Time Playback
- Web Audio API: Precise timing with lookahead scheduling
- Configurable Sounds: Waveform, frequency, volume, envelope controls
- Tempo Control: 60-180 BPM range
- Visual Synchronization: Animated onset highlighting
MIDI Output System
- Cross-Browser MIDI: Direct MIDI output to DAWs and hardware
- WebMIDI Support: Native MIDI in Chrome, Edge, Opera, Brave
- Safari Bridge: WebSocket bridge for Safari with Python helper
- Real-Time Performance: Synchronized MIDI note on/off messages
- DAW Integration: Connect to GarageBand, Logic, Ableton, and more
- Hardware Support: MIDI controllers, drum machines, synthesizers
MIDI Setup:
- Brave/Chrome: Enable MIDI in app → Grant permission → Direct output
- Safari: Run
python3 minimal-midi-bridge.py
→ Enable MIDI in app
- Output Routing: Configure IAC Driver (Mac) or virtual MIDI ports
Circular Visualization
- Geometric Display: Onsets arranged on circle
- Center of Gravity: Real-time geometric analysis
- Pattern Recognition: Visual pattern identification
- Interactive Controls: Click to modify patterns
Precision Timing
- Lookahead Scheduling: Eliminates JavaScript timing jitter
- Buffer Management: Smooth playback without glitches
- Sync Resolution: Audio and visual perfect synchronization
- MIDI Timing: Sub-millisecond accuracy for professional use
6. Database & Management
Pattern Storage
- Local Storage: Browser-based persistence
- Metadata Tracking: Creation date, type, analysis results
- Automatic Analysis: Complete mathematical breakdown on save
- Duplicate Detection: Prevents redundant storage
Search & Filtering
- Text Search: Find patterns by name or description
- Category Filters: Euclidean, Polygons, Generated, Mutated, Barlow Transformed, etc.
- Step Count Range: Filter by pattern length
- Balance Filters: Perfect balance, geometric centering
- Rhythmic Filters: Syncopation levels, complexity metrics
Import/Export
- JSON Format: Complete pattern data with analysis
- Backup/Restore: Full database operations
- Pattern Sharing: Export individual or bulk patterns
- Cross-Device: Transfer patterns between browsers
Theoretical Background
Andrew Milne’s Perfect Balance Theory
Andrew Milne’s work on perfect balance provides the mathematical foundation for understanding rhythmic equilibrium. A pattern is perfectly balanced when the sum of its onset vectors equals zero:
Where:
kⱼ
are the onset positions
n
is the total number of steps
i
is the imaginary unit
Key Insights:
- Perfect balance creates perceptually stable rhythms
- Can be achieved through polygon combinations and strategic subtraction
- Relates to symmetry and geometric distribution
- Provides objective measure of rhythmic “centeredness”
Reference: Milne, A. J. (2011). Perfect balance: A novel principle for the construction of musical scales and meters.
Clarence Barlow’s Indispensability Theory
Barlow’s indispensability theory quantifies the metric importance of each position in a rhythmic cycle:
Core Concepts:
- Prime Factorization: Meter decomposed into prime factors
- Hierarchical Structure: Positions ranked by divisibility
- Syncopation Measurement: Deviation from metric expectations
- Transformation Logic: Add/remove onsets based on importance
Enhanced Calculation Method:
For position p in meter n:
- If p = 0: indispensability = 1.0 (downbeat)
- If p = n-1: indispensability = 0.75 (pickup beat)
- Else: 1 / (product of prime factors of (n/gcd(p, n)))
Musical Applications:
- Automatic rhythm simplification/complexification
- Syncopation analysis and generation
- Cultural rhythm analysis
- Compositional assistance
Reference: Barlow, C. (1987). Two essays on theory. Computer Music Journal, 11(1), 44-60.
Godfried Toussaint’s Euclidean Rhythms
Toussaint’s research revealed that the Euclidean algorithm for finding the greatest common divisor, when applied to rhythm, generates patterns found in traditional music worldwide:
Algorithm:
- Distribute k onsets as evenly as possible among n steps
- Equivalent to Euclidean algorithm: gcd(k,n)
- Results in maximally even distribution
Cultural Examples:
E(3,8)
: Cuban tresillo, Afro-Cuban clave
E(5,8)
: Cuban cinquillo
E(2,5)
: Korean traditional rhythms
E(3,7)
: Tuareg rhythms from Libya
Reference: Toussaint, G. T. (2005). The Euclidean algorithm generates traditional musical rhythms.
Extended Theoretical Framework
Geometric Music Theory
- Transformational Theory: Mathematical operations on musical objects
- Neo-Riemannian Theory: Harmonic relationships through geometric spaces
- Rhythmic Spaces: Treating rhythms as points in mathematical spaces
- Pattern Complexity: Kolmogorov complexity of rhythmic sequences
- Predictability Measures: Information entropy of rhythm patterns
- Compression Ratios: Efficiency of pattern representations
Cognitive Science Connections
- Metric Perception: How humans perceive rhythmic structure
- Beat Tracking: Neurological basis of rhythm processing
- Cultural Encoding: How rhythmic knowledge is culturally transmitted
Creative Misuse & Experimental Applications
Unconventional Musical Applications
Microtiming Generators
- Use tiny step counts (3-5) to generate microtiming templates
- Apply to drum programming for humanization
- Create subtle groove variations
Polyrhythmic Orchestration
- Generate multiple complementary patterns simultaneously
- Use different step counts for cross-rhythmic relationships
- Create complex ensemble textures
Harmonic Rhythm Mapping
- Map rhythm patterns to chord progressions
- Use onset positions to trigger harmonic changes
- Create mathematical relationships between rhythm and harmony
Melodic Contour Generation
- Convert rhythm patterns to pitch sequences
- Use onset density for melodic activity
- Generate voice-leading from geometric properties
Time Signature Mutation
- Use quantization feature to mutate between meters
E(3,8);12
transforms 4/4 tresillo to 12/8 feel
- Create metric modulations based on mathematical relationships
Anti-Musical Pattern Creation
- Enable Wolrab mode for maximum metric disruption
- Progressive dilution from dense to sparse with reversed logic
- Create rhythms that actively fight against expectations
Non-Musical Applications
Visual Art Generation
- Convert patterns to geometric designs
- Use balance calculations for visual composition
- Generate fractal-like structures from pattern recursions
- Map indispensability values to color intensity
Data Sonification
- Map scientific data to rhythmic patterns
- Use pattern analysis for data visualization
- Create auditory representations of mathematical functions
- Convert time-series data to Euclidean approximations
Procedural Game Design
- Generate level layouts from rhythm patterns
- Use pattern complexity for difficulty curves
- Create enemy spawn patterns from Euclidean rhythms
- Map perfect balance to game equilibrium states
Architecture & Design
- Apply perfect balance principles to spatial design
- Use rhythmic proportions in architectural planning
- Generate decorative patterns from mathematical rhythms
- Create modular systems based on LCM calculations
Cryptography & Code
- Use pattern properties for pseudo-random generation
- Create visual hash functions from rhythm analysis
- Generate passwords from memorable rhythm patterns
- Use syncopation levels for complexity validation
Experimental Research Applications
Computational Musicology
- Analyze large corpora of traditional rhythms
- Test cross-cultural rhythm universals
- Quantify stylistic differences between musical traditions
- Build databases of mathematically characterized patterns
Algorithmic Composition
- Generate training data for AI composition systems
- Create constraint-based composition tools
- Develop new notational systems for complex rhythms
- Build rhythm recommendation systems
Cognitive Science Research
- Test perception of mathematically generated rhythms
- Study cultural biases in rhythm recognition
- Investigate neural correlates of rhythmic complexity
- Measure entrainment to perfect balance patterns
Music Therapy Applications
- Generate rhythms for specific therapeutic goals
- Use mathematical properties for predictable emotional responses
- Create personalized rhythm prescriptions
- Study rhythm’s effect on cognitive states
Advanced Experimental Techniques
Pattern Evolution Workflows
- Start Simple: Begin with
E(2,8)
(basic alternating)
- Add Complexity: Apply Barlow concentration to 5 onsets
- Invert Logic: Switch to Wolrab mode
- Anti-Develop: Progressive dilution with reversed indispensability
- Mutate Character: Apply stochastic syncopation mutation
- Analyze Emergence: Study how anti-patterns develop musical interest
Multi-Scale Rhythmic Analysis
- Generate Hierarchy: Create patterns at 4, 8, 16, 32 steps
- Find Relationships: Use quantization to connect scales
- Perfect Balance Mapping: Track balance across scales
- Fractal Detection: Look for self-similar structures
Cross-Cultural Pattern Synthesis
- Input Traditional Rhythms: Enter known cultural patterns
- Extract Mathematics: Analyze indispensability profiles
- Generate Hybrids: Combine mathematical properties
- Test Perceptual Validity: Check if combinations “work” musically
Temporal Illusion Creation
- Perfect Balance Paradoxes: Create rhythms that feel centered but aren’t
- Metric Ambiguity: Use Wolrab mode to obscure downbeats
- False Pickups: Create patterns where anacrusis feels like downbeat
- Syncopation Saturation: Find the point where syncopation becomes new metric
- Live Pattern Evolution: Real-time Barlow transformations during performance
- Audience Interaction: Map crowd response to transformation parameters
- AI Collaboration: Feed generated patterns to machine learning systems
- Biometric Rhythm: Use physiological data to drive pattern parameters
Mathematical Music Games
- Perfect Balance Challenges: Find combinations that achieve exact balance
- Cultural Pattern Matching: Identify traditional rhythms from mathematical descriptions
- Complexity Competitions: Create most/least complex patterns within constraints
- Transformation Puzzles: Achieve target patterns through minimal transformations
Technical Architecture
Frontend Architecture
Modular Design
app/
├── index.html # Main application entry point
├── app-styles.css # Complete UI styling and responsive design
├── platform-utils.js # Cross-platform compatibility and keyboard handling
├── math-renderer.js # Mathematical equation rendering with MathJax
├── math-core.js # Mathematical utilities and algorithms
├── app-config.js # Configuration constants and settings
├── pattern-generators.js # Euclidean, polygon, and geometric generators
├── pattern-analysis.js # Balance, syncopation, and complexity analysis
├── pattern-processing.js # Universal parser and format converters
├── pattern-exploration.js # Systematic discovery algorithms
├── pattern-database.js # Storage, search, and management
├── sequencer-audio.js # Web Audio API and sound synthesis
├── sequencer-visual.js # Circular visualization and graphics
├── sequencer-controller.js # Playback control and integration
├── midi-output.js # MIDI output system with cross-browser support
├── webrtc-osc.js # OSC communication for MIDI bridges
├── ui-components.js # Reusable interface components
└── app-controller-browser.js # Main orchestrator and event handling
Mathematical Rendering System
- MathJax Integration: Professional mathematical notation rendering
- LaTeX Support: Full LaTeX equation syntax for complex mathematical expressions
- Dynamic Rendering: Real-time equation rendering for interactive content
- Cross-Platform Compatibility: Consistent mathematical display across all browsers
- Responsive Equations: Adaptive sizing for mobile and desktop displays
- Interactive Formulas: Clickable buttons to show/hide mathematical details
- Efficient Parsing: Single-pass pattern recognition
- Caching Systems: Store analysis results
- Memory Management: Prevent leaks in long sessions
- Lazy Loading: Defer non-critical calculations
- Equation Rendering: On-demand MathJax rendering for optimal performance
Audio System
Web Audio API Implementation
- Precision Scheduling: Lookahead buffering for sub-millisecond accuracy
- Configurable Synthesis: Multiple waveforms (sine, square, triangle, sawtooth)
- ADSR Envelopes: Attack and release control
- Cross-Browser Compatibility: Handles browser differences gracefully
Audio Features
- Real-Time Parameter Control: Tempo, volume, frequency adjustment
- Visual Synchronization: Perfect audio-visual alignment
- Performance Monitoring: Track timing accuracy and performance
- Fallback Systems: Graceful degradation when audio unavailable
Mathematical Libraries
Core Algorithms
- Prime Factorization: Efficient factor decomposition for indispensability
- GCD Calculations: Euclidean algorithm implementation
- Complex Number Operations: Vector mathematics for balance analysis
- Statistical Functions: Pattern complexity and entropy measures
- LCM Computation: Pattern combination mathematics
Specialized Functions
- Euclidean Distribution: Bjorklund’s algorithm implementation
- Perfect Balance Detection: Complex vector sum calculations
- Syncopation Measurement: Barlow indispensability scoring
- Pattern Transformation: Mathematical mutation operations
Data Structures
Pattern Representation
{
steps: [true, false, true, ...], // Boolean array of onsets
stepCount: 8, // Total time steps
name: "Tresillo", // Human-readable identifier
binary: "10010010", // Binary string representation
expression: "E(3,8)", // Original input expression
analysis: { // Comprehensive mathematical analysis
balance: {
magnitude: 0.125,
normalizedMagnitude: 0.042,
isPerfectlyBalanced: false,
balanceScore: "good"
},
syncopation: {
level: "moderate",
score: 0.67,
complexity: 0.43
},
geometry: {
centerOfGravity: { x: 0.125, y: -0.33 },
magnitude: 0.354
}
},
metadata: {
timestamp: 1640995200000,
type: "euclidean",
isGenerated: false,
tags: ["traditional", "cuban"]
}
}
Database Schema
- Patterns: Core rhythm data with full analysis
- Categories: Hierarchical organization system
- Relationships: Pattern derivation and similarity
- Search Indices: Optimized lookup structures
Usage Examples
Basic Pattern Analysis
Input: E(3,8)
Analysis Results:
- Binary: 10010010
- Balance: Good (magnitude: 0.125)
- Syncopation: Moderate (Barlow score: 0.67)
- Center of Gravity: (0.125, -0.33)
- Cultural Context: Cuban Tresillo
- Indispensability Profile: [1.0, 0.0625, 0.1875, 0.0625, ...]
1. Start Pattern: E(5,16) → 1000100010001000
2. Barlow Analysis: 5 onsets, moderate syncopation
3. Progressive Dilution: Reduce to 3 onsets → 1000100000000000
4. Enable Wolrab Mode: Reverse indispensability logic
5. Progressive Concentration: Increase to 7 onsets → 0101011010001000
6. Stochastic Mutation: Apply syncopation style, 50% intensity
7. Final Result: 0101010110001000 (anti-metrical groove)
Perfect Balance Discovery
Systematic Exploration: P(3,x)+P(5,y)-P(2,z)
Results:
- P(3,1)+P(5,0)-P(2,0): Perfect Balance (0.000)
- P(3,0)+P(5,2)-P(2,1): Perfect Balance (0.000)
- P(3,2)+P(5,1)-P(2,0): Perfect Balance (0.000)
Mathematical Verification:
- Vector sum: (0.000 + 0.000i)
- Geometric center: Origin (0,0)
- Perceptual stability: Maximum
Cultural Pattern Analysis
Traditional Rhythms Analysis:
1. Tresillo: E(3,8) → Moderate syncopation, Cuban origin
2. Cinquillo: E(5,8) → High complexity, Cuban/Brazilian
3. Gahu: E(7,12) → Complex polyrhythmic, West African
4. Samba: Custom pattern → High syncopation, Brazilian
Cross-Cultural Synthesis:
- Mathematical commonalities identified
- Hybrid patterns generated using shared properties
- Perceptual validation through balance analysis
Installation & Setup
Requirements
- Browser: Chrome, Firefox, Safari, or Edge (modern versions)
- JavaScript: ES6 support required
- Audio: Web Audio API support
- Storage: Local storage enabled for database functionality
- No Build Process: Pure vanilla JavaScript, no dependencies
Local Development
- Clone or download the repository
- Open
app/index.html
in a web browser
- For development, use a local server to avoid CORS restrictions:
# Python 3
python -m http.server 8000
# Node.js
npx serve .
Browser Compatibility
- Chrome: Full support, recommended for best performance
- Firefox: Full support with all features
- Safari: Full support (may require user gesture for audio)
- Edge: Full support
- Mobile: Basic functionality on modern mobile browsers with touch adaptations
- Mac (macOS/iOS): Uses Cmd key for keyboard shortcuts
- Windows: Uses Ctrl key for keyboard shortcuts
- Linux: Uses Ctrl key for keyboard shortcuts
- Mobile/Touch: Alternative tap-based interactions when keyboard shortcuts unavailable
- Automatic Detection: Platform detected automatically with appropriate UI adaptations
Keyboard Shortcuts
- Universal Input: Enter = Parse pattern, Cmd+Enter (Mac) / Ctrl+Enter (Windows/Linux) = Parse & Add to Database
- Progressive Transformations: Enter in Target Onsets boxes for step-by-step transformations
- Progressive Offsets: Enter in Forward/Backward Step boxes for progressive offset stepping
- Step Count Filters: Enter to apply filtering
- Mobile Alternative: All keyboard shortcuts have equivalent button-based alternatives
Documentation System
- Dual Format Support: Both Markdown (GitHub) and HTML (interactive) documentation
- Mathematical Equations: Properly rendered LaTeX equations in HTML documentation using MathJax
- Interactive Features: Clickable navigation, expandable sections, and live equation rendering
- Maintenance Tools: Automated consistency checking between documentation formats
- Algorithm Documentation: Complete mathematical descriptions of all core algorithms
- Optimized for desktop use with large displays
- Responsive design adapts to different screen sizes
- Audio features work best with headphones or good speakers
- Large databases (1000+ patterns) may impact performance on older devices
- Touch-friendly interface scaling on mobile devices
Contributing
Areas for Development
- Additional Generators: Genetic algorithms, neural networks, L-systems
- Cultural Database: Traditional rhythms from world music traditions
- Advanced Visualization: 3D pattern spaces, interactive animations
- Machine Learning: Pattern recognition, style classification, generation
- Collaboration Features: Real-time multi-user pattern creation
- Mobile Optimization: Touch-friendly interface, gesture control
Research Opportunities
- Cross-Cultural Analysis: Mathematical universals in world rhythms
- Perceptual Validation: User studies on mathematical vs. perceptual rhythm properties
- Cognitive Science: Neural correlates of mathematical rhythm properties
- AI Integration: Machine learning models trained on mathematically characterized patterns
- Therapeutic Applications: Rhythm prescription based on mathematical properties
Code Contributions
- Follow existing code style and modular architecture
- Add comprehensive documentation for new features
- Include mathematical references for theoretical implementations
- Test across multiple browsers and devices
- Consider performance impact of new algorithms
References
Primary Research
-
Milne, A. J. (2011). Perfect balance: A novel principle for the construction of musical scales and meters. Music Perception, 28(1), 85-104.
-
Barlow, C. (1987). Two essays on theory. Computer Music Journal, 11(1), 44-60.
-
Toussaint, G. T. (2005). The Euclidean algorithm generates traditional musical rhythms. Proceedings of BRIDGES, 47-56.
-
Toussaint, G. T. (2013). The geometry of musical rhythm: What makes a “good” rhythm good? CRC Press.
Mathematical Foundations
-
Lewin, D. (1987). Generalized musical intervals and transformations. Yale University Press.
-
Clough, J., & Douthett, J. (1991). Maximally even sets. Journal of Music Theory, 35(1), 93-173.
-
Mazzola, G. (2002). The topos of music: Geometric logic of concepts, theory, and performance. Birkhäuser.
-
Tymoczko, D. (2011). A geometry of music: Harmony and counterpoint in the extended common practice. Oxford University Press.
Cognitive Science & Perception
-
London, J. (2012). Hearing in time: Psychological aspects of musical meter. Oxford University Press.
-
Lerdahl, F., & Jackendoff, R. (1983). A generative theory of tonal music. MIT Press.
-
Pressing, J. (2002). Black Atlantic rhythm: Its computational and transcultural foundations. Music Perception, 19(3), 285-310.
-
Temperley, D. (2001). The cognition of basic musical structures. MIT Press.
Algorithmic & Computational
-
Bjorklund, E. (2003). The theory of rep-rate pattern generation in the SNS timing system. Los Alamos National Laboratory Technical Report.
-
Simha Arom (1991). African polyphony and polyrhythm: Musical structure and methodology. Cambridge University Press.
-
Agmon, E. (1997). Musical durations as mathematical intervals: Some implications for the theory and analysis of rhythm. Musical Quarterly, 81(4), 468-485.
Conclusion
The Rhythm Pattern Explorer represents a convergence of mathematical music theory, computational algorithms, and creative exploration tools. By implementing rigorous academic research in an accessible, interactive format, it opens new possibilities for understanding, creating, and manipulating rhythmic patterns.
Whether used for traditional composition, experimental music creation, academic research, or pure mathematical exploration, the application provides a powerful lens through which to examine the deep structures underlying rhythmic experience. The inclusion of experimental features like Wolrab mode demonstrates how mathematical inversions can lead to genuinely new musical territories.
The open architecture and comprehensive documentation make it suitable for both casual experimentation and serious research applications. As computational music theory continues to evolve, tools like this help bridge the gap between abstract mathematical concepts and tangible musical results.
This documentation represents the current state of the Rhythm Pattern Explorer as of 2024. The application continues to evolve with new features, theoretical insights, and creative applications.
License: Open source - feel free to modify, distribute, and build upon this work.
Acknowledgments: This project builds upon decades of research by music theorists, mathematicians, and computer scientists who have worked to understand the mathematical foundations of musical experience.