You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: implement proportional timing fallback for sparse pulse data (Issue #28)
**Root Cause Analysis:**
The fractional_beat clustering issue was caused by sparse pulse data in real
transcription meters. While synthetic meters have complete pulse arrays (32/32
pulses), real transcription data contains only manually annotated pulses (2/32
pulses), breaking pulse-based timing calculations.
**Key Discovery:**
- Real meters: _pulses_per_cycle=32, all_pulses count=2 (6% of expected!)
- Synthetic meters: _pulses_per_cycle=32, all_pulses count=32 (100% complete)
- Previous fix using full positions was ineffective - didn't address pulse sparsity
**Solution:**
1. **Detection**: Check if pulse count < 50% of expected pulses
2. **Fallback**: Use proportional cycle timing instead of broken pulse indexing
3. **Preservation**: Maintain existing pulse-based functionality for complete data
**New Methods:**
- `_calculate_proportional_level_start_time()`: Beat boundaries via cycle division
- `_calculate_proportional_level_duration()`: Unit durations via hierarchical ratios
**Results Validation:**
- Real data fractional_beat: 0.000-0.026 → 0.104-0.881 ✅
- Synthetic data: unchanged (0.104-0.881) ✅
- Near-identical values between real and synthetic meters ✅
- All 29 tests passing with no regressions ✅
This fix ensures musical visualizations properly distribute events across beat
durations instead of clustering them at beat boundaries, resolving the core
issue described in GitHub Issue #28.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
0 commit comments