Commit db498b6
committed
feat: implement musical time conversion functionality
- Add MusicalTime dataclass with cycle, hierarchical position, and fractional beat
- Add Meter.get_musical_time() method with optional reference level support
- Support arbitrary hierarchical depth (beat, subdivision, sub-subdivision, etc.)
- Use pulse-based fractional calculation to handle rubato and irregular timing
- Add comprehensive test suite with 18 test cases covering all functionality
- Update package exports for MusicalTime class
- Implement specification from docs/musical-time-spec.md
Features:
- Convert real time to musical position within meter boundaries
- Reference levels allow fractional calculation at any hierarchy level
- Handles complex meters like [3, 2, 4] with proper level naming
- Returns False for out-of-bounds times, MusicalTime for valid times
- String representations: compact (C0:2.1+0.500) and readable formats1 parent d0e0ba3 commit db498b6
File tree
5 files changed
+928
-1
lines changed- docs
- idtap
- classes
- tests
5 files changed
+928
-1
lines changed
0 commit comments